Files
sdk/tests/language/syntax/syntax_native_test.dart
T
Johnni Winther e77907f755 [test] Extract test for "native"
This move the test of the "native" syntax, support by the CFE, to
a separate test. The test (expecting the syntax to _not_ be supported)
fails on the CFE but that has nothing to with the records/patterns
features which the remaining tests in syntax_test.dart require.

Change-Id: Idef0d8b58b24488bcd4e3318eac9638152056b2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280111
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-01 10:06:37 +00:00

49 lines
1.0 KiB
Dart

// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class DOMWindow {}
class Window extends DOMWindow
native "*Window" //# 28: syntax error
{}
class Console
native "=(typeof console == 'undefined' ? {} : console)" //# 29: syntax error
{}
class NativeClass
native "FooBar" //# 30: syntax error
{}
abstract class Fisk {}
class BoolImplementation implements Fisk
native "Boolean" //# 31: syntax error
{}
class _JSON
native 'JSON' //# 32: syntax error
{}
class ListFactory<E> implements List<E>
native "Array" //# 33: syntax error
{
noSuchMethod(_) => null; // Allow unimplemented methods
}
main() {
try {
new Window();
new Console();
new NativeClass();
new BoolImplementation();
new _JSON();
new ListFactory();
new ListFactory<Object>();
} catch (ex) {
// Swallowing exceptions. Any error should be a compile-time error
// which kills the current isolate.
}
}