| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 class SyntaxTest { | |
| 6 // "this" cannot be used as a field name. | |
| 7 SyntaxTest this; /// 01: compile-time error | |
| 8 | |
| 9 // Syntax error. | |
| 10 foo {} /// 02: compile-time error | |
| 11 | |
| 12 // Syntax error. | |
| 13 static foo {} /// 03: compile-time error | |
| 14 | |
| 15 // Syntax error. | |
| 16 operator +=() {} /// 04: compile-time error | |
| 17 | |
| 18 // Syntax error. | |
| 19 operator -=() {} /// 05: compile-time error | |
| 20 | |
| 21 // Syntax error. | |
| 22 operator *=() {} /// 06: compile-time error | |
| 23 | |
| 24 // Syntax error. | |
| 25 operator /=() {} /// 07: compile-time error | |
| 26 | |
| 27 // Syntax error. | |
| 28 operator ~/=() {} /// 08: compile-time error | |
| 29 | |
| 30 // Syntax error. | |
| 31 operator %=() {} /// 09: compile-time error | |
| 32 | |
| 33 // Syntax error. | |
| 34 operator <<=() {} /// 10: compile-time error | |
| 35 | |
| 36 // Syntax error. | |
| 37 operator >>=() {} /// 11: compile-time error | |
| 38 | |
| 39 // Syntax error. | |
| 40 operator >>>=() {} /// 12: compile-time error | |
| 41 | |
| 42 // Syntax error. | |
| 43 operator &=() {} /// 13: compile-time error | |
| 44 | |
| 45 // Syntax error. | |
| 46 operator ^=() {} /// 14: compile-time error | |
| 47 | |
| 48 // Syntax error. | |
| 49 operator |=() {} /// 15: compile-time error | |
| 50 | |
| 51 // Syntax error. | |
| 52 operator ?() {} /// 16: compile-time error | |
| 53 | |
| 54 // Syntax error. | |
| 55 operator ||() {} /// 17: compile-time error | |
| 56 | |
| 57 // Syntax error. | |
| 58 operator &&() {} /// 18: compile-time error | |
| 59 | |
| 60 // Syntax error. | |
| 61 operator !=() {} /// 19: compile-time error | |
| 62 | |
| 63 // Syntax error. | |
| 64 operator ===() {} /// 20: compile-time error | |
| 65 | |
| 66 // Syntax error. | |
| 67 operator !==() {} /// 21: compile-time error | |
| 68 | |
| 69 // Syntax error. | |
| 70 operator is() {} /// 22: compile-time error | |
| 71 | |
| 72 // Syntax error. | |
| 73 operator !() {} /// 23: compile-time error | |
| 74 | |
| 75 // Syntax error. | |
| 76 operator ++() {} /// 24: compile-time error | |
| 77 | |
| 78 // Syntax error. | |
| 79 operator --() {} /// 25: compile-time error | |
| 80 | |
| 81 // Syntax error. | |
| 82 bool operator ===(A other) { return true; } /// 26: compile-time error | |
| 83 | |
| 84 int sample; | |
| 85 } | |
| 86 | |
| 87 fisk {} /// 27: compile-time error | |
| 88 | |
| 89 class DOMWindow {} | |
| 90 | |
| 91 class Window extends DOMWindow | |
| 92 native "*Window" /// 28: compile-time error | |
| 93 {} | |
| 94 | |
| 95 class Console | |
| 96 native "=(typeof console == 'undefined' ? {} : console)" /// 29: compile-time er
ror | |
| 97 {} | |
| 98 | |
| 99 class NativeClass | |
| 100 native "FooBar" /// 30: compile-time error | |
| 101 {} | |
| 102 | |
| 103 interface Fisk {} | |
| 104 | |
| 105 class BoolImplementation implements Fisk | |
| 106 native "Boolean" /// 31: compile-time error | |
| 107 {} | |
| 108 | |
| 109 class _JSON | |
| 110 native 'JSON' /// 32: compile-time error | |
| 111 {} | |
| 112 | |
| 113 class ListFactory<E> implements List<E> | |
| 114 native "Array" /// 33: compile-time error | |
| 115 {} | |
| 116 | |
| 117 interface I extends UNKNOWN; /// 34: compile-time error | |
| 118 | |
| 119 class XWindow extends DOMWindow | |
| 120 hest "*Window" /// 35: compile-time error | |
| 121 {} | |
| 122 | |
| 123 class XConsole | |
| 124 hest "=(typeof console == 'undefined' ? {} : console)" /// 36: compile-time erro
r | |
| 125 {} | |
| 126 | |
| 127 class XNativeClass | |
| 128 hest "FooBar" /// 37: compile-time error | |
| 129 {} | |
| 130 | |
| 131 class XBoolImplementation implements Fisk | |
| 132 hest "Boolean" /// 38: compile-time error | |
| 133 {} | |
| 134 | |
| 135 class _JSONX | |
| 136 hest 'JSON' /// 39: compile-time error | |
| 137 {} | |
| 138 | |
| 139 class XListFactory<E> implements List<E> | |
| 140 hest "Array" /// 40: compile-time error | |
| 141 {} | |
| 142 | |
| 143 class YWindow extends DOMWindow | |
| 144 for "*Window" /// 41: compile-time error | |
| 145 {} | |
| 146 | |
| 147 class YConsole | |
| 148 for "=(typeof console == 'undefined' ? {} : console)" /// 42: compile-time error | |
| 149 {} | |
| 150 | |
| 151 class YNativeClass | |
| 152 for "FooBar" /// 43: compile-time error | |
| 153 {} | |
| 154 | |
| 155 class YBoolImplementation implements Fisk | |
| 156 for "Boolean" /// 44: compile-time error | |
| 157 {} | |
| 158 | |
| 159 class _JSONY | |
| 160 for 'JSON' /// 45: compile-time error | |
| 161 {} | |
| 162 | |
| 163 class YListFactory<E> implements List<E> | |
| 164 for "Array" /// 46: compile-time error | |
| 165 {} | |
| 166 | |
| 167 class A { | |
| 168 const A() | |
| 169 {} /// 47: compile-time error | |
| 170 ; | |
| 171 } | |
| 172 | |
| 173 interface G<T> {} | |
| 174 | |
| 175 typedef <T>(); /// 48: compile-time error | |
| 176 | |
| 177 class B | |
| 178 extends void /// 49: compile-time error | |
| 179 {} | |
| 180 | |
| 181 main() { | |
| 182 try { | |
| 183 new SyntaxTest(); | |
| 184 fisk(); /// 27: continued | |
| 185 | |
| 186 new Window(); | |
| 187 new Console(); | |
| 188 new NativeClass(); | |
| 189 new BoolImplementation(); | |
| 190 new _JSON(); | |
| 191 new ListFactory(); | |
| 192 new ListFactory<Object>(); | |
| 193 var x = null; | |
| 194 x is I; /// 34: continued | |
| 195 | |
| 196 new XConsole(); | |
| 197 new XNativeClass(); | |
| 198 new XBoolImplementation(); | |
| 199 new _JSONX(); | |
| 200 new XListFactory(); | |
| 201 new XListFactory<Object>(); | |
| 202 | |
| 203 new YConsole(); | |
| 204 new YNativeClass(); | |
| 205 new YBoolImplementation(); | |
| 206 new _JSONY(); | |
| 207 new YListFactory(); | |
| 208 new YListFactory<Object>(); | |
| 209 | |
| 210 futureOf(x) {} | |
| 211 if (!(fisk futureOf(false))) {} /// 50: compile-time error | |
| 212 if (!(await futureOf(false))) {} /// 51: compile-time error | |
| 213 | |
| 214 void f{} /// 52: compile-time error | |
| 215 G<int double> g; /// 53: compile-time error | |
| 216 f(void) {}; /// 54: compile-time error | |
| 217 | |
| 218 optionalArg([x]) {} | |
| 219 optionalArg( | |
| 220 void (var i) {} /// 55: compile-time error | |
| 221 ); | |
| 222 | |
| 223 function __PROTO__$(...args) { return 12; } /// 56: compile-time error | |
| 224 G<> t; /// 57: compile-time error | |
| 225 G<null> t; /// 58: compile-time error | |
| 226 A<void> a = null; /// 59: compile-time error | |
| 227 void v; /// 60: compile-time error | |
| 228 void v = null; /// 61: compile-time error | |
| 229 print(null is void); /// 62: compile-time error | |
| 230 new B(); | |
| 231 | |
| 232 new Bad(); | |
| 233 | |
| 234 } catch (var ex) { | |
| 235 // Swallowing exceptions. Any error should be a compile-time error | |
| 236 // which kills the current isolate. | |
| 237 } | |
| 238 } | |
| 239 | |
| 240 class Bad { | |
| 241 factory Bad<Bad(String type) { return null; } /// 63: compile-time error | |
| 242 } | |
| OLD | NEW |