mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:37:12 +00:00
16ac19d097
Reports an error if there are external members in an extension, where the extension on type is not a JS interop class. A follow up change will allow extensions with external members on some Native classes, like dart:html classes. Change-Id: I01c645aa46e46071aae5f380c5e36329f61d3e18 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207722 Commit-Queue: Riley Porter <rileyporter@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com> Reviewed-by: Srujan Gaddam <srujzs@google.com>
71 lines
3 KiB
Dart
71 lines
3 KiB
Dart
// Copyright (c) 2020, 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.
|
|
|
|
// Checks for static errors related to parameters for methods.
|
|
|
|
@JS()
|
|
library js_parameters_static_test;
|
|
|
|
import 'package:js/js.dart';
|
|
import 'package:expect/expect.dart';
|
|
|
|
@JS()
|
|
class Foo {
|
|
external int singleNamedArg({int? a});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
external int mixedNamedArgs(int a, {int? b});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
}
|
|
|
|
@JS()
|
|
class Bar {
|
|
external static int singleNamedArg({int? a});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
external static int mixedNamedArgs(int a, {int? b});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
}
|
|
|
|
external int singleNamedArg({int? a});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
external int mixedNamedArgs(int a, {int? b});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
|
|
@JS()
|
|
@anonymous
|
|
class Baz {
|
|
external int singleNamedArg({int? a});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
external int mixedNamedArgs(int a, {int? b});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
}
|
|
|
|
@JS()
|
|
abstract class Qux {
|
|
external int singleNamedArg({int? a});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
external int mixedNamedArgs(int a, {int? b});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
}
|
|
|
|
extension ExtensionFoo on Foo {
|
|
external int singleNamedArg({int? a});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
external int mixedNamedArgs(int a, {int? b});
|
|
// ^
|
|
// [web] Named parameters for JS interop functions are only allowed in a factory constructor of an @anonymous JS class.
|
|
}
|
|
|
|
main() {}
|