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