diff --git a/pkg/front_end/lib/src/kernel/resolver.dart b/pkg/front_end/lib/src/kernel/resolver.dart index 796bc3fb450..dc9b15904f8 100644 --- a/pkg/front_end/lib/src/kernel/resolver.dart +++ b/pkg/front_end/lib/src/kernel/resolver.dart @@ -721,9 +721,8 @@ class Resolver { internalThisVariable: internalThisVariable, forPrimaryConstructor: true, ); - - context.performBacklog(result.annotations); } + context.performBacklog(result.annotations); } // Coverage-ignore(suite): Not run. on DebugAbort { diff --git a/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart new file mode 100644 index 00000000000..213014243f6 --- /dev/null +++ b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart @@ -0,0 +1,13 @@ +// Copyright (c) 2026, 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 const Self(); + +class Base { + Base(int x); +} + +class MyComponent(@Self() final int? x) extends Base { + this : super(42); +} diff --git a/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.expect b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.expect new file mode 100644 index 00000000000..2ede27c910e --- /dev/null +++ b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.expect @@ -0,0 +1,36 @@ +library; +import self as self; +import "dart:core" as core; + +class Self extends core::Object /*hasConstConstructor*/ { + const constructor •() → self::Self + : super core::Object::•() + ; + static synthetic method _#new#tearOff() → self::Self + return new self::Self::•(); +} +class Base extends core::Object { + constructor •(core::int x) → self::Base + : super core::Object::•() + ; + static synthetic method _#new#tearOff(core::int x) → self::Base + return new self::Base::•(x); +} +class MyComponent extends self::Base { + final field core::int? x; + constructor •(@#C1 final initializing-formal core::int? x) → self::MyComponent + : self::MyComponent::x = x, super self::Base::•(42) + ; + static synthetic method _#new#tearOff(core::int? x) → self::MyComponent + return new self::MyComponent::•(x); +} + +constants { + #C1 = self::Self {} +} + + +Constructor coverage from constants: +org-dartlang-testcase:///parameter_annotation.dart: +- Self. (from org-dartlang-testcase:///parameter_annotation.dart:5:17) +- Object. (from org-dartlang-sdk:///lib/core/object.dart) diff --git a/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.modular.expect b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.modular.expect new file mode 100644 index 00000000000..2ede27c910e --- /dev/null +++ b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.modular.expect @@ -0,0 +1,36 @@ +library; +import self as self; +import "dart:core" as core; + +class Self extends core::Object /*hasConstConstructor*/ { + const constructor •() → self::Self + : super core::Object::•() + ; + static synthetic method _#new#tearOff() → self::Self + return new self::Self::•(); +} +class Base extends core::Object { + constructor •(core::int x) → self::Base + : super core::Object::•() + ; + static synthetic method _#new#tearOff(core::int x) → self::Base + return new self::Base::•(x); +} +class MyComponent extends self::Base { + final field core::int? x; + constructor •(@#C1 final initializing-formal core::int? x) → self::MyComponent + : self::MyComponent::x = x, super self::Base::•(42) + ; + static synthetic method _#new#tearOff(core::int? x) → self::MyComponent + return new self::MyComponent::•(x); +} + +constants { + #C1 = self::Self {} +} + + +Constructor coverage from constants: +org-dartlang-testcase:///parameter_annotation.dart: +- Self. (from org-dartlang-testcase:///parameter_annotation.dart:5:17) +- Object. (from org-dartlang-sdk:///lib/core/object.dart) diff --git a/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.outline.expect b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.outline.expect new file mode 100644 index 00000000000..12c06f4f931 --- /dev/null +++ b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.outline.expect @@ -0,0 +1,24 @@ +library; +import self as self; +import "dart:core" as core; + +class Self extends core::Object /*hasConstConstructor*/ { + const constructor •() → self::Self + : super core::Object::•() + ; + static synthetic method _#new#tearOff() → self::Self + return new self::Self::•(); +} +class Base extends core::Object { + constructor •(core::int x) → self::Base + ; + static synthetic method _#new#tearOff(core::int x) → self::Base + return new self::Base::•(x); +} +class MyComponent extends self::Base { + final field core::int? x; + constructor •(final initializing-formal core::int? x) → self::MyComponent + ; + static synthetic method _#new#tearOff(core::int? x) → self::MyComponent + return new self::MyComponent::•(x); +} diff --git a/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.transformed.expect b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.transformed.expect new file mode 100644 index 00000000000..2ede27c910e --- /dev/null +++ b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.strong.transformed.expect @@ -0,0 +1,36 @@ +library; +import self as self; +import "dart:core" as core; + +class Self extends core::Object /*hasConstConstructor*/ { + const constructor •() → self::Self + : super core::Object::•() + ; + static synthetic method _#new#tearOff() → self::Self + return new self::Self::•(); +} +class Base extends core::Object { + constructor •(core::int x) → self::Base + : super core::Object::•() + ; + static synthetic method _#new#tearOff(core::int x) → self::Base + return new self::Base::•(x); +} +class MyComponent extends self::Base { + final field core::int? x; + constructor •(@#C1 final initializing-formal core::int? x) → self::MyComponent + : self::MyComponent::x = x, super self::Base::•(42) + ; + static synthetic method _#new#tearOff(core::int? x) → self::MyComponent + return new self::MyComponent::•(x); +} + +constants { + #C1 = self::Self {} +} + + +Constructor coverage from constants: +org-dartlang-testcase:///parameter_annotation.dart: +- Self. (from org-dartlang-testcase:///parameter_annotation.dart:5:17) +- Object. (from org-dartlang-sdk:///lib/core/object.dart) diff --git a/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.textual_outline.expect b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.textual_outline.expect new file mode 100644 index 00000000000..46c6b312aab --- /dev/null +++ b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.textual_outline.expect @@ -0,0 +1,9 @@ +class const Self(); + +class Base { + Base(int x); +} + +class MyComponent(@Self() final int? x) extends Base { + this : super(42); +} diff --git a/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..c73d56dbd87 --- /dev/null +++ b/pkg/front_end/testcases/dart2js/primary_constructors/parameter_annotation.dart.textual_outline_modelled.expect @@ -0,0 +1,9 @@ +class Base { + Base(int x); +} + +class MyComponent(@Self() final int? x) extends Base { + this : super(42); +} + +class const Self();