Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
// 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 following applies to both the header and the body form of
/// declaring constructors.
///
/// The semantics of the declaring constructor is found in the following steps,
/// where `D` is the class, extension type, or enum declaration in the program
/// that includes a declaring constructor, and `D2` is the result of the
/// derivation of the semantics of `D`. The derivation step will delete elements
/// that amount to the declaring constructor; it will add a new constructor `k`;
/// and it will add zero or more instance variable declarations.
/// @assertion The semantics of the primary constructor is found in the
/// following steps, where `D` is the class, mixin class, extension type, or
/// enum declaration in the program that includes a primary constructor `k`, and
/// `D2` is the result of the derivation of the semantics of `D`. The derivation
/// step will delete elements that amount to the primary constructor.
/// Semantically, it will add a new constructor `k2`, and it will add zero or
/// more instance variable declarations.
///
/// Where no processing is mentioned below, `D2` is identical to `D`. Changes
/// occur as follows:
Expand All @@ -23,7 +21,9 @@
/// the superinterfaces of `D` exists and has return type `T`, the parameter
/// `p` has declared type `T`. If no such getter exists, but a setter with the
/// same basename exists, with a formal parameter whose type is `T`, the
/// parameter `p` has declared type `T`.
/// parameter `p` has declared type `T`. In other words, an instance variable
/// introduced by a declaring parameter is subject to override inference, just
/// like an explicitly declared instance variable.
///
/// @description Check that if the combined member signature for a getter with
/// the same name as `p` from the superinterfaces of `D` exists, and has return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
// 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 following applies to both the header and the body form of
/// declaring constructors.
///
/// The semantics of the declaring constructor is found in the following steps,
/// where `D` is the class, extension type, or enum declaration in the program
/// that includes a declaring constructor, and `D2` is the result of the
/// derivation of the semantics of `D`. The derivation step will delete elements
/// that amount to the declaring constructor; it will add a new constructor `k`;
/// and it will add zero or more instance variable declarations.
/// @assertion The semantics of the primary constructor is found in the
/// following steps, where `D` is the class, mixin class, extension type, or
/// enum declaration in the program that includes a primary constructor `k`, and
/// `D2` is the result of the derivation of the semantics of `D`. The derivation
/// step will delete elements that amount to the primary constructor.
/// Semantically, it will add a new constructor `k2`, and it will add zero or
/// more instance variable declarations.
///
/// Where no processing is mentioned below, `D2` is identical to `D`. Changes
/// occur as follows:
Expand All @@ -23,7 +21,9 @@
/// the superinterfaces of `D` exists and has return type `T`, the parameter
/// `p` has declared type `T`. If no such getter exists, but a setter with the
/// same basename exists, with a formal parameter whose type is `T`, the
/// parameter `p` has declared type `T`.
/// parameter `p` has declared type `T`. In other words, an instance variable
/// introduced by a declaring parameter is subject to override inference, just
/// like an explicitly declared instance variable.
///
/// @description Check that if the combined member signature for a setter with
/// the same basename as `p` from the superinterfaces of `D` exists, and has a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
// 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 following applies to both the header and the body form of
/// declaring constructors.
///
/// The semantics of the declaring constructor is found in the following steps,
/// where `D` is the class, extension type, or enum declaration in the program
/// that includes a declaring constructor, and `D2` is the result of the
/// derivation of the semantics of `D`. The derivation step will delete elements
/// that amount to the declaring constructor; it will add a new constructor `k`;
/// and it will add zero or more instance variable declarations.
/// @assertion The semantics of the primary constructor is found in the
/// following steps, where `D` is the class, mixin class, extension type, or
/// enum declaration in the program that includes a primary constructor `k`, and
/// `D2` is the result of the derivation of the semantics of `D`. The derivation
/// step will delete elements that amount to the primary constructor.
/// Semantically, it will add a new constructor `k2`, and it will add zero or
/// more instance variable declarations.
///
/// Where no processing is mentioned below, `D2` is identical to `D`. Changes
/// occur as follows:
Expand All @@ -22,7 +20,7 @@
/// ...
/// - otherwise, if `p` is optional and has a default value whose static type in
/// the empty context is a type `T` which is not `Null` then `p` has declared
/// type `T`. When `T` is `Null`, `p` has declared type `Object?`.
/// type `T`. When `T` is `Null`, `p` instead has declared type `Object?`.
///
/// @description Check that if `p` does not have a declared type, but it does
/// have a default value whose static type is `T` which is not `Null` then `p`
Expand All @@ -45,6 +43,42 @@ class C5({var x = 5 as Object});

class C6({var x = 6 as dynamic});

extension type ET1([final x = 1]);

extension type ET2([final x = 2 as num]);

extension type ET3([final x = 3 as dynamic]);

extension type ET4({final x = 4});

extension type ET5({final x = 5 as Object});

extension type ET6({final x = 6 as dynamic});

enum const E1([final x = 1]) {
e0;
}

enum const E2([final x = 2 as num]) {
e0;
}

enum const E3([final x = 3 as dynamic]) {
e0;
}

enum const E4({final x = 4}) {
e0;
}

enum const E5({final x = 5 as Object}) {
e0;
}

enum const E6({final x = 6 as dynamic}) {
e0;
}

main() {
C1().x.expectStaticType<Exactly<int>>();
C2().x.expectStaticType<Exactly<num>>();
Expand All @@ -56,4 +90,26 @@ main() {
try {
C6().x.checkDynamic;
} catch (_) {}

ET1().x.expectStaticType<Exactly<int>>();
ET2().x.expectStaticType<Exactly<num>>();
try {
ET3().x.checkDynamic;
} catch (_) {}
ET4().x.expectStaticType<Exactly<int>>();
ET5().x.expectStaticType<Exactly<Object>>();
try {
ET6().x.checkDynamic;
} catch (_) {}

E1.e0.x.expectStaticType<Exactly<int>>();
E2.e0.x.expectStaticType<Exactly<num>>();
try {
E3.e0.x.checkDynamic;
} catch (_) {}
E4.e0.x.expectStaticType<Exactly<int>>();
E5.e0.x.expectStaticType<Exactly<Object>>();
try {
E6.e0.x.checkDynamic;
} catch (_) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
// 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 following applies to both the header and the body form of
/// declaring constructors.
///
/// The semantics of the declaring constructor is found in the following steps,
/// where `D` is the class, extension type, or enum declaration in the program
/// that includes a declaring constructor, and `D2` is the result of the
/// derivation of the semantics of `D`. The derivation step will delete elements
/// that amount to the declaring constructor; it will add a new constructor `k`;
/// and it will add zero or more instance variable declarations.
/// @assertion The semantics of the primary constructor is found in the
/// following steps, where `D` is the class, mixin class, extension type, or
/// enum declaration in the program that includes a primary constructor `k`, and
/// `D2` is the result of the derivation of the semantics of `D`. The derivation
/// step will delete elements that amount to the primary constructor.
/// Semantically, it will add a new constructor `k2`, and it will add zero or
/// more instance variable declarations.
///
/// Where no processing is mentioned below, `D2` is identical to `D`. Changes
/// occur as follows:
Expand All @@ -22,7 +20,7 @@
/// ...
/// - otherwise, if `p` is optional and has a default value whose static type in
/// the empty context is a type `T` which is not `Null` then `p` has declared
/// type `T`. When `T` is `Null`, `p` has declared type `Object?`.
/// type `T`. When `T` is `Null`, `p` instead has declared type `Object?`.
///
/// @description Check that if `p` does not have a declared type, but it does
/// have a default value whose static type is `Null` then `p` has the declared
Expand All @@ -41,9 +39,27 @@ class C3({final x = null});

class C4({var x = null});

extension type ET1([final x = null]);

extension type ET2({final x = null});

enum const E1([final x = null]) {
e0;
}

enum const E2({final x = null}) {
e0;
}

main() {
C1().x.expectStaticType<Exactly<Object?>>();
C2().x.expectStaticType<Exactly<Object?>>();
C3().x.expectStaticType<Exactly<Object?>>();
C4().x.expectStaticType<Exactly<Object?>>();

ET1().x.expectStaticType<Exactly<Object?>>();
ET2().x.expectStaticType<Exactly<Object?>>();

E1.e0.x.expectStaticType<Exactly<Object?>>();
E2.e0.x.expectStaticType<Exactly<Object?>>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
// 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 following applies to both the header and the body form of
/// declaring constructors.
///
/// The semantics of the declaring constructor is found in the following steps,
/// where `D` is the class, extension type, or enum declaration in the program
/// that includes a declaring constructor, and `D2` is the result of the
/// derivation of the semantics of `D`. The derivation step will delete elements
/// that amount to the declaring constructor; it will add a new constructor `k`;
/// and it will add zero or more instance variable declarations.
/// @assertion The semantics of the primary constructor is found in the
/// following steps, where `D` is the class, mixin class, extension type, or
/// enum declaration in the program that includes a primary constructor `k`, and
/// `D2` is the result of the derivation of the semantics of `D`. The derivation
/// step will delete elements that amount to the primary constructor.
/// Semantically, it will add a new constructor `k2`, and it will add zero or
/// more instance variable declarations.
///
/// Where no processing is mentioned below, `D2` is identical to `D`. Changes
/// occur as follows:
Expand All @@ -37,11 +35,23 @@ class C2(final x, [final y]);

class C3(final x, {final y});

class C4(var x, {var x});
class C4(var x, {var y});

class C5(final x, {required final y});

class C6(var x, {required var x});
class C6(var x, {required var y});

extension type ET1([final x]);

extension type ET2({final x});

enum const E1([final x]) {
e0;
}

enum const E2({final x}) {
e0;
}

main() {
C1(1).x.expectStaticType<Exactly<Object?>>();
Expand All @@ -56,4 +66,10 @@ main() {
C5(5, y: 5).y.expectStaticType<Exactly<Object?>>();
C6(6, y: 6).x.expectStaticType<Exactly<Object?>>();
C6(6, y: 6).y.expectStaticType<Exactly<Object?>>();

ET1().x.expectStaticType<Exactly<Object?>>();
ET2().x.expectStaticType<Exactly<Object?>>();

E1.e0.x.expectStaticType<Exactly<Object?>>();
E2.e0.x.expectStaticType<Exactly<Object?>>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
// 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 following applies to both the header and the body form of
/// declaring constructors.
///
/// The semantics of the declaring constructor is found in the following steps,
/// where `D` is the class, extension type, or enum declaration in the program
/// that includes a declaring constructor, and `D2` is the result of the
/// derivation of the semantics of `D`. The derivation step will delete elements
/// that amount to the declaring constructor; it will add a new constructor `k`;
/// and it will add zero or more instance variable declarations.
/// @assertion The semantics of the primary constructor is found in the
/// following steps, where `D` is the class, mixin class, extension type, or
/// enum declaration in the program that includes a primary constructor `k`, and
/// `D2` is the result of the derivation of the semantics of `D`. The derivation
/// step will delete elements that amount to the primary constructor.
/// Semantically, it will add a new constructor `k2`, and it will add zero or
/// more instance variable declarations.
///
/// Where no processing is mentioned below, `D2` is identical to `D`. Changes
/// occur as follows:
Expand Down Expand Up @@ -40,12 +38,24 @@ class C4([final x = null]);

class C5(final x, {final y});

class C6(var x, {var x});
class C6(var x, {var y});

class C7({final x = null});

class C8({var x = null});

extension type ET1([final x]);

extension type ET2({final x});

enum const E1([final x]) {
e0;
}

enum const E2({final x}) {
e0;
}

main() {
C1(1).x.checkDynamic;
// ^^^^^^^^^^^^
Expand Down Expand Up @@ -94,5 +104,23 @@ main() {
C8().x.checkDynamic;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

ET1().x.checkDynamic;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
ET2().x.checkDynamic;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

E1.e0.x.checkDynamic;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
E2.e0.x.checkDynamic;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}
Loading