diff --git a/Language/Libraries_and_Scripts/Imports/deferred_import_t01.dart b/Language/Libraries_and_Scripts/Imports/deferred_import_t01.dart deleted file mode 100644 index 3c7027d475..0000000000 --- a/Language/Libraries_and_Scripts/Imports/deferred_import_t01.dart +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2011, 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. - -/// @assertion The current library is the library currently being compiled. The -/// import modifies the import namespace of the current library in a manner that -/// is determined by the imported library and by the optional elements of the -/// import. -/// . . . -/// Let I be an import directive that refers to a URI via the string s1. -/// Evaluation of I proceeds as follows: -/// -/// If I is a deferred import, no evaluation takes place. Instead, a mapping of -/// the name of the prefix, p to a deferred prefix object is added to the scope -/// of the current library L. The deferred prefix object has the following -/// methods: -/// • loadLibrary. This method returns a future f. When called, the method -/// causes an immediate import I to be executed at some future time, where -/// I is derived from I by eliding the word deferred and adding a hide -/// loadLibrary combinator clause. When I executes without error, f completes -/// successfully. If I executes without error, we say that the call to -/// loadLibrary has succeeded, otherwise we say the call has failed. -/// • For every top level function f named id in the imported library B, a -/// corresponding method named id with the same signature as f. Calling -/// the method results in a runtime error. -/// • For every top level getter g named id in B, a corresponding getter named -/// id with the same signature as g. Calling the method results in a runtime -/// error. -/// • For every top level setter s named id in B, a corresponding setter named -/// id with the same signature as s. Calling the method results in a runtime -/// error. -/// • For every type T named id in B, a corresponding getter named id with -/// return type Type. Calling the method results in a runtime error. -/// . . . -/// After a call succeeds, the name p is mapped to a non-deferred prefix object -/// as described below. In addition, the prefix object also supports the -/// loadLibrary method, and so it is possible to call loadLibrary again. If -/// a call fails, nothing happens, and one again has the option to call -/// loadLibrary again. Whether a repeated call to loadLibrary succeeds will -/// vary as described below. -/// The effect of a repeated call to p.loadLibrary is as follows: -/// • If another call to p.loadLibrary has already succeeded, the repeated call -/// also succeeds. Otherwise, -/// • If another call to p.loadLibrary has failed: -/// – If the failure is due to a compilation error, the repeated call fails -/// for the same reason. -/// – If the failure is due to other causes, the repeated call behaves as if -/// no previous call had been made. -/// In other words, one can retry a deferred load after a network failure or -/// because a file is absent, but once one finds some content and loads it, one -/// can no longer reload. -/// -/// @description Checks that a deferred prefix object has a method loadLibrary, -/// returning a future f, and for every top-level declaration in the imported -/// library a corresponding declaration with the same name in the current -/// library. Calling the imported name results in a runtime error. -/// @Issue 33118 -/// @issue 42491 -/// @author ngl@unipro.ru - -import "dart:async"; -import "../../../Utils/expect.dart"; -import "static_type_lib.dart" deferred as p; - -main() { - - Expect.throws(() { p.someFunc(); }, (e) => e is NoSuchMethodError); - Expect.throws(() { p.someGetter; }, (e) => e is NoSuchMethodError); - Expect.throws(() { p.someSetter = 2; }, (e) => e is NoSuchMethodError); - Expect.throws(() { p.Func; }, (e) => e is NoSuchMethodError); - - Expect.isTrue(p.loadLibrary() is Future); - Expect.runtimeIsType(p.loadLibrary()); -} diff --git a/Language/Libraries_and_Scripts/Imports/deferred_import_t02.dart b/Language/Libraries_and_Scripts/Imports/deferred_import_t02.dart deleted file mode 100644 index dd1ec1831b..0000000000 --- a/Language/Libraries_and_Scripts/Imports/deferred_import_t02.dart +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2011, 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. - -/// @assertion The current library is the library currently being compiled. The -/// import modifies the import namespace of the current library in a manner that -/// is determined by the imported library and by the optional elements of the -/// import. -/// . . . -/// Let I be an import directive that refers to a URI via the string s1. -/// Evaluation of I proceeds as follows: -/// -/// If I is a deferred import, no evaluation takes place. Instead, a mapping of -/// the name of the prefix, p to a deferred prefix object is added to the scope -/// of the current library L. The deferred prefix object has the following -/// methods: -/// • loadLibrary. This method returns a future f. When called, the method -/// causes an immediate import I to be executed at some future time, where -/// I is derived from I by eliding the word deferred and adding a hide -/// loadLibrary combinator clause. When I executes without error, f completes -/// successfully. If I executes without error, we say that the call to -/// loadLibrary has succeeded, otherwise we say the call has failed. -/// • For every top level function f named id in the imported library B, a -/// corresponding method named id with the same signature as f. Calling -/// the method results in a runtime error. -/// • For every top level getter g named id in B, a corresponding getter named -/// id with the same signature as g. Calling the method results in a runtime -/// error. -/// • For every top level setter s named id in B, a corresponding setter named -/// id with the same signature as s. Calling the method results in a runtime -/// error. -/// • For every type T named id in B, a corresponding getter named id with -/// return type Type. Calling the method results in a runtime error. -/// . . . -/// After a call succeeds, the name p is mapped to a non-deferred prefix object -/// as described below. In addition, the prefix object also supports the -/// loadLibrary method, and so it is possible to call loadLibrary again. If -/// a call fails, nothing happens, and one again has the option to call -/// loadLibrary again. Whether a repeated call to loadLibrary succeeds will -/// vary as described below. -/// The effect of a repeated call to p.loadLibrary is as follows: -/// • If another call to p.loadLibrary has already succeeded, the repeated call -/// also succeeds. Otherwise, -/// • If another call to p.loadLibrary has failed: -/// – If the failure is due to a compilation error, the repeated call fails -/// for the same reason. -/// – If the failure is due to other causes, the repeated call behaves as if -/// no previous call had been made. -/// In other words, one can retry a deferred load after a network failure or -/// because a file is absent, but once one finds some content and loads it, one -/// can no longer reload. -/// -/// @description Checks that if a library is load successfully, prefix is -/// mapped to a non-deferred prefix object, and top-level declarations from -/// the imported library became accessed in the current library with specified -/// prefix. -/// @author ngl@unipro.ru - -import "dart:async"; -import "../../../Utils/expect.dart"; -import "static_type_lib.dart" deferred as p; - -test_loaded() { - p.someFunc(); - p.someGetter; - p.someSetter = 1; - p.Func; - Expect.isTrue(p.loadLibrary() is Future); - Expect.runtimeIsType(p.loadLibrary()); -} - -main() { - p.loadLibrary().then((v) { - test_loaded(); - }, - onError: (e) { - Expect.fail("Library should be loaded"); - }); -} diff --git a/Language/Libraries_and_Scripts/Imports/same_name_prefix_A01_t01.dart b/Language/Libraries_and_Scripts/Imports/same_name_prefix_A01_t01.dart new file mode 100644 index 0000000000..38bc2b56d6 --- /dev/null +++ b/Language/Libraries_and_Scripts/Imports/same_name_prefix_A01_t01.dart @@ -0,0 +1,23 @@ +// 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. + +/// @assertion It is a compile-time error if the prefix used in a deferred +/// import is also used as the prefix of another import clause +/// +/// @description Checks that it is a compile-time error if the prefix used in a +/// deferred import is also used as the prefix of another deferred import clause +/// @author sgrekhov22@gmail.com + +import 'static_type_lib.dart' deferred as p; +// ^^^^^^^^ +// [analyzer] unspecified + +import 'syntax_lib.dart' deferred as p; +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { + p.loadLibrary(); +} diff --git a/Language/Libraries_and_Scripts/Imports/same_name_prefix_A01_t02.dart b/Language/Libraries_and_Scripts/Imports/same_name_prefix_A01_t02.dart new file mode 100644 index 0000000000..1935e49e2b --- /dev/null +++ b/Language/Libraries_and_Scripts/Imports/same_name_prefix_A01_t02.dart @@ -0,0 +1,22 @@ +// 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. + +/// @assertion It is a compile-time error if the prefix used in a deferred +/// import is also used as the prefix of another import clause +/// +/// @description Checks that it is a compile-time error if the prefix used in a +/// deferred import is also used as the prefix of another immediate import +/// clause +/// @author sgrekhov22@gmail.com + +import 'static_type_lib.dart' deferred as p; +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +import 'syntax_lib.dart' as p; + +main() { + p.loadLibrary(); +} diff --git a/Language/Libraries_and_Scripts/Imports/same_name_prefix_A02_t01.dart b/Language/Libraries_and_Scripts/Imports/same_name_prefix_A02_t01.dart new file mode 100644 index 0000000000..2b12406305 --- /dev/null +++ b/Language/Libraries_and_Scripts/Imports/same_name_prefix_A02_t01.dart @@ -0,0 +1,20 @@ +// 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. + +/// @assertion It is a compile-time error if the prefix used in a deferred +/// import is also used as the prefix of another import clause +/// +/// @description Checks that it is not an error if the prefix used in a +/// non-deferred import is also used as the prefix of another immediate import +/// clause +/// @author sgrekhov22@gmail.com + +import '../../../Utils/expect.dart'; +import 'static_type_lib.dart' as p; +import 'syntax_lib.dart' as p; + +main() { + Expect.equals(1, p.someFunc()); // from static_type_lib.dart + Expect.equals("hide", p.hide); // from syntax_lib.dart +} diff --git a/Language/Libraries_and_Scripts/Imports/same_name_prefix_A02_t02.dart b/Language/Libraries_and_Scripts/Imports/same_name_prefix_A02_t02.dart new file mode 100644 index 0000000000..43014ff6c2 --- /dev/null +++ b/Language/Libraries_and_Scripts/Imports/same_name_prefix_A02_t02.dart @@ -0,0 +1,23 @@ +// 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. + +/// @assertion It is a compile-time error if the prefix used in a deferred +/// import is also used as the prefix of another import clause +/// +/// @description Checks that it is not an error if two deferred libraries with +/// two different prefixes are imported +/// @author sgrekhov22@gmail.com + +import '../../../Utils/expect.dart'; +import 'static_type_lib.dart' deferred as p1; +import 'syntax_lib.dart' deferred as p2; + +main() async { + asyncStart(); + await p1.loadLibrary(); + await p2.loadLibrary(); + Expect.equals(1, p1.someFunc()); // from static_type_lib.dart + Expect.equals("hide", p2.hide); // from syntax_lib.dart + asyncEnd(); +} diff --git a/Language/Libraries_and_Scripts/Imports/semantics_A01_t01.dart b/Language/Libraries_and_Scripts/Imports/semantics_A01_t01.dart new file mode 100644 index 0000000000..e06a3b47fd --- /dev/null +++ b/Language/Libraries_and_Scripts/Imports/semantics_A01_t01.dart @@ -0,0 +1,32 @@ +// 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. + +/// @assertion Let Ii be an import directive that refers to a URI via the string +/// si. The semantics of Ii is specified as follows: +/// Case ⟨Semantics of deferred imports⟩. If Ii is a deferred import with prefix +/// p, a binding of p to a deferred prefix run-time namespace NSdeferred is +/// present in the library namespace of the current library L. Let NSimport,i be +/// the namespace imported from the library specified by Ii. +/// NSdeferred then has the following bindings: +/// • The name loadLibrary is bound to a function with signature +/// Future loadLibrary(). This function returns a future f. When called, +/// the function causes an immediate import I′ to be executed at some future +/// time, where I′ is derived from Ii by eliding the word deferred and adding +/// a hide loadLibrary combinator clause. The execution of the immediate +/// import may fail for implementation specific reasons. For instance, I′ +/// imports a different library than the one that the specified URI referred +/// to at compiletime; or an OS level file read error occurs; etc. We say that +/// the invocation of loadLibrary succeeds if f completes with a value, and +/// that the invocation fails if f completes with an error. +/// +/// @description Checks that static type of `loadLibrary` is +/// `Future Function()` +/// @author sgrekhov22@gmail.com + +import "static_type_lib.dart" deferred as p; +import "../../../Utils/static_type_helper.dart"; + +main() { + p.loadLibrary.expectStaticType Function()>>(); +} diff --git a/Language/Libraries_and_Scripts/Imports/semantics_A01_t02.dart b/Language/Libraries_and_Scripts/Imports/semantics_A01_t02.dart new file mode 100644 index 0000000000..65e2971ed8 --- /dev/null +++ b/Language/Libraries_and_Scripts/Imports/semantics_A01_t02.dart @@ -0,0 +1,49 @@ +// Copyright (c) 2011, 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. + +/// @assertion Let Ii be an import directive that refers to a URI via the string +/// si. The semantics of Ii is specified as follows: +/// Case ⟨Semantics of deferred imports⟩. If Ii is a deferred import with prefix +/// p, a binding of p to a deferred prefix run-time namespace NSdeferred is +/// present in the library namespace of the current library L. Let NSimport,i be +/// the namespace imported from the library specified by Ii. +/// NSdeferred then has the following bindings: +/// • The name loadLibrary is bound to a function with signature +/// Future loadLibrary(). This function returns a future f. When called, +/// the function causes an immediate import I′ to be executed at some future +/// time, where I′ is derived from Ii by eliding the word deferred and adding +/// a hide loadLibrary combinator clause. The execution of the immediate +/// import may fail for implementation specific reasons. For instance, I′ +/// imports a different library than the one that the specified URI referred +/// to at compiletime; or an OS level file read error occurs; etc. We say that +/// the invocation of loadLibrary succeeds if f completes with a value, and +/// that the invocation fails if f completes with an error. +/// +/// @description Checks that call of `loadLibrary` causes an immediate import of +/// the deferred library +/// @author ngl@unipro.ru + +import "../../../Utils/expect.dart"; +import "static_type_lib.dart" deferred as p; + +void testLoaded() { + Expect.equals(1, p.someFunc()); + Expect.equals(3, p.someVar); + Expect.equals(2, p.someGetter); + p.someSetter = 1; + p.Func; + Expect.isTrue(p.loadLibrary() is Future); + Expect.runtimeIsType>(p.loadLibrary()); +} + +main() { + asyncStart(); + p.loadLibrary().then((v) { + testLoaded(); + asyncEnd(); + }, + onError: (e) { + Expect.fail("Library should be loaded"); + }); +} diff --git a/Language/Libraries_and_Scripts/Imports/semantics_A02_t01.dart b/Language/Libraries_and_Scripts/Imports/semantics_A02_t01.dart new file mode 100644 index 0000000000..08efe831cd --- /dev/null +++ b/Language/Libraries_and_Scripts/Imports/semantics_A02_t01.dart @@ -0,0 +1,39 @@ +// Copyright (c) 2011, 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. + +/// @assertion Let Ii be an import directive that refers to a URI via the string +/// si. The semantics of Ii is specified as follows: +/// Case ⟨Semantics of deferred imports⟩. If Ii is a deferred import with prefix +/// p, a binding of p to a deferred prefix run-time namespace NSdeferred is +/// present in the library namespace of the current library L. Let NSimport,i be +/// the namespace imported from the library specified by Ii. +/// NSdeferred then has the following bindings: +/// ... +/// • For every top level function f named id in NSimport,i, a corresponding +/// function named id with the same signature as f. Calling the function +/// results in a dynamic error that occurs before any actual arguments are +/// evaluated. Closurizing the function also results in a dynamic error. +/// • For every top level getter g named id in NSimport,i, a corresponding +/// getter named id with the same signature as g. Calling the getter results +/// in a dynamic error. +/// • For every top level setter s named id= in NSimport,i, a corresponding +/// setter named id= with the same signature as s. Calling the setter results +/// in a dynamic error that occurs before the actual argument is evaluated. +/// +/// @description Checks that for every top-level declaration in the imported +/// library a corresponding declaration with the same name created in the +/// current library. Calling the imported name results in a runtime error. +/// @Issue 33118 +/// @issue 42491 +/// @author ngl@unipro.ru + +import "../../../Utils/expect.dart"; +import "static_type_lib.dart" deferred as p; + +main() { + Expect.throws(() { p.someFunc(); }, (e) => e is NoSuchMethodError); + Expect.throws(() { p.someGetter; }, (e) => e is NoSuchMethodError); + Expect.throws(() { p.someSetter = 2; }, (e) => e is NoSuchMethodError); + Expect.throws(() { p.Func; }, (e) => e is NoSuchMethodError); +} diff --git a/Language/Libraries_and_Scripts/Imports/semantics_A02_t02.dart b/Language/Libraries_and_Scripts/Imports/semantics_A02_t02.dart new file mode 100644 index 0000000000..1f519f4810 --- /dev/null +++ b/Language/Libraries_and_Scripts/Imports/semantics_A02_t02.dart @@ -0,0 +1,52 @@ +// 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. + +/// @assertion Let Ii be an import directive that refers to a URI via the string +/// si. The semantics of Ii is specified as follows: +/// Case ⟨Semantics of deferred imports⟩. If Ii is a deferred import with prefix +/// p, a binding of p to a deferred prefix run-time namespace NSdeferred is +/// present in the library namespace of the current library L. Let NSimport,i be +/// the namespace imported from the library specified by Ii. +/// NSdeferred then has the following bindings: +/// ... +/// • For every top level function f named id in NSimport,i, a corresponding +/// function named id with the same signature as f. Calling the function +/// results in a dynamic error that occurs before any actual arguments are +/// evaluated. Closurizing the function also results in a dynamic error. +/// • For every top level getter g named id in NSimport,i, a corresponding +/// getter named id with the same signature as g. Calling the getter results +/// in a dynamic error. +/// • For every top level setter s named id= in NSimport,i, a corresponding +/// setter named id= with the same signature as s. Calling the setter results +/// in a dynamic error that occurs before the actual argument is evaluated. +/// +/// @description Checks that calling a function from a deferred library before +/// `loadLibrary()` call results in a dynamic error that occurs before any +/// actual arguments are evaluated. +/// @author sgrekhov22@gmail.com + +import "../../../Utils/expect.dart"; +import "static_type_lib.dart" deferred as p; + +String log = ""; + +class C { + int value; + C(this.value); + int operator +(int other) { + log = "C($value).+($other)"; + return value + other; + } +} + +main() { + Expect.throws(() { + p.someFunc(C(1) + 2); + }); + Expect.equals("", log); + Expect.throws(() { + p.someSetter = C(2) + 3; + }); + Expect.equals("", log); +} diff --git a/Language/Libraries_and_Scripts/Imports/semantics_A02_t03.dart b/Language/Libraries_and_Scripts/Imports/semantics_A02_t03.dart new file mode 100644 index 0000000000..1f03a1c253 --- /dev/null +++ b/Language/Libraries_and_Scripts/Imports/semantics_A02_t03.dart @@ -0,0 +1,35 @@ +// 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. + +/// @assertion Let Ii be an import directive that refers to a URI via the string +/// si. The semantics of Ii is specified as follows: +/// Case ⟨Semantics of deferred imports⟩. If Ii is a deferred import with prefix +/// p, a binding of p to a deferred prefix run-time namespace NSdeferred is +/// present in the library namespace of the current library L. Let NSimport,i be +/// the namespace imported from the library specified by Ii. +/// NSdeferred then has the following bindings: +/// ... +/// • For every top level function f named id in NSimport,i, a corresponding +/// function named id with the same signature as f. Calling the function +/// results in a dynamic error that occurs before any actual arguments are +/// evaluated. Closurizing the function also results in a dynamic error. +/// • For every top level getter g named id in NSimport,i, a corresponding +/// getter named id with the same signature as g. Calling the getter results +/// in a dynamic error. +/// • For every top level setter s named id= in NSimport,i, a corresponding +/// setter named id= with the same signature as s. Calling the setter results +/// in a dynamic error that occurs before the actual argument is evaluated. +/// +/// @description Checks that closurizing a function from a deferred library +/// before the future returned by `loadLibrary()` has been completed +/// @author sgrekhov22@gmail.com + +import "../../../Utils/expect.dart"; +import "static_type_lib.dart" deferred as p; + +main() { + Expect.throws(() { + p.someFunc; + }); +} diff --git a/Language/Libraries_and_Scripts/Imports/semantics_A03_t01.dart b/Language/Libraries_and_Scripts/Imports/semantics_A03_t01.dart new file mode 100644 index 0000000000..cbc28cc28a --- /dev/null +++ b/Language/Libraries_and_Scripts/Imports/semantics_A03_t01.dart @@ -0,0 +1,39 @@ +// 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. + +/// @assertion Let Ii be an import directive that refers to a URI via the string +/// si. The semantics of Ii is specified as follows: +/// Case ⟨Semantics of deferred imports⟩. If Ii is a deferred import with prefix +/// p, a binding of p to a deferred prefix run-time namespace NSdeferred is +/// present in the library namespace of the current library L. Let NSimport,i be +/// the namespace imported from the library specified by Ii. +/// NSdeferred then has the following bindings: +/// ... +/// • For every class, mixin, enum, and type alias declaration named id in +/// NSimport,i, a corresponding getter named id with return type Type. Calling +/// the getter results in a dynamic error. +/// +/// @description Checks that for every class, mixin, enum, and type alias +/// declaration in the imported library a corresponding getter with the same +/// name and return type `Type` is present in the namespace denoted by the +/// deferred import prefix. An invocation of this getter is a dynamic error. +/// @author sgrekhov22@gmail.com + +import "../../../Utils/expect.dart"; +import "static_type_lib.dart" deferred as p; + +main() { + Expect.throws(() { + Type t = p.SomeClass; + }); + Expect.throws(() { + Type t = p.SomeClassAlias; + }); + Expect.throws(() { + Type t = p.SomeEnum; + }); + Expect.throws(() { + Type t = p.SomeMixin; + }); +} diff --git a/Language/Libraries_and_Scripts/Imports/semantics_A04_t01.dart b/Language/Libraries_and_Scripts/Imports/semantics_A04_t01.dart new file mode 100644 index 0000000000..7c8a4b2ddf --- /dev/null +++ b/Language/Libraries_and_Scripts/Imports/semantics_A04_t01.dart @@ -0,0 +1,30 @@ +// 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. + +/// @assertion The effect of a repeated invocation of p.loadLibrary() is as +/// follows: +/// • If another invocation of p.loadLibrary() has already succeeded, the +/// repeated invocation also succeeds. Otherwise, +/// • If another invocation of p.loadLibrary() has failed: +/// – If the failure is due to a compilation error, the repeated invocation +/// fails for the same reason. +/// – If the failure is due to other causes, the repeated invocation behaves +/// as if no previous call had been made. +/// +/// @description Checks that if an invocation of `p.loadLibrary()` has already +/// succeeded, then the repeated invocation also succeeds +/// @author sgrekhov22@gmail.com + +import "../../../Utils/expect.dart"; +import "static_type_lib.dart" deferred as p; + +main() { + asyncStart(); + p.loadLibrary().then((_) { + p.foo; + p.loadLibrary().then((_) { + asyncEnd(); + }); + }); +} diff --git a/Language/Libraries_and_Scripts/Imports/static_type_lib.dart b/Language/Libraries_and_Scripts/Imports/static_type_lib.dart index 80e83a962c..2fd08e9a8d 100644 --- a/Language/Libraries_and_Scripts/Imports/static_type_lib.dart +++ b/Language/Libraries_and_Scripts/Imports/static_type_lib.dart @@ -12,8 +12,16 @@ int get someGetter => 2; void set someSetter(int val) {} -int someFunc() => 1; +int someFunc([int x = 0]) => x + 1; class SomeClass {} +typedef SomeClassAlias = SomeClass; + typedef int Func(Object a); + +enum SomeEnum { + e1, e2; +} + +mixin SomeMixin {}