-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CFE/kernel] Fix crash on TypeParameter.declaration when compiling co…
…nstructor with annotation on type parameter with name clash Change-Id: Ic56cfc8f4eaafe3a6d25371b6ae5deb452651543 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395001 Commit-Queue: Jens Johansen <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
- Loading branch information
Showing
9 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
pkg/front_end/testcases/regress/annotation_on_type_parameter_name_clash_on_constructor.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
const int x = 42; | ||
|
||
class Foo { | ||
Foo<@x x>() {} | ||
} |
25 changes: 25 additions & 0 deletions
25
...stcases/regress/annotation_on_type_parameter_name_clash_on_constructor.dart.strong.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/annotation_on_type_parameter_name_clash_on_constructor.dart:8:6: Error: Constructors can't have type parameters. | ||
// Try removing the type parameters. | ||
// Foo<@x x>() {} | ||
// ^^^^^^ | ||
// | ||
// pkg/front_end/testcases/regress/annotation_on_type_parameter_name_clash_on_constructor.dart:8:8: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. | ||
// Foo<@x x>() {} | ||
// ^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
class Foo extends core::Object { | ||
constructor •() → self::Foo | ||
: super core::Object::•() {} | ||
} | ||
static const field core::int x = #C1; | ||
|
||
constants { | ||
#C1 = 42 | ||
} |
25 changes: 25 additions & 0 deletions
25
...regress/annotation_on_type_parameter_name_clash_on_constructor.dart.strong.modular.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/annotation_on_type_parameter_name_clash_on_constructor.dart:8:6: Error: Constructors can't have type parameters. | ||
// Try removing the type parameters. | ||
// Foo<@x x>() {} | ||
// ^^^^^^ | ||
// | ||
// pkg/front_end/testcases/regress/annotation_on_type_parameter_name_clash_on_constructor.dart:8:8: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. | ||
// Foo<@x x>() {} | ||
// ^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
class Foo extends core::Object { | ||
constructor •() → self::Foo | ||
: super core::Object::•() {} | ||
} | ||
static const field core::int x = #C1; | ||
|
||
constants { | ||
#C1 = 42 | ||
} |
21 changes: 21 additions & 0 deletions
21
...regress/annotation_on_type_parameter_name_clash_on_constructor.dart.strong.outline.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/annotation_on_type_parameter_name_clash_on_constructor.dart:8:6: Error: Constructors can't have type parameters. | ||
// Try removing the type parameters. | ||
// Foo<@x x>() {} | ||
// ^^^^^^ | ||
// | ||
// pkg/front_end/testcases/regress/annotation_on_type_parameter_name_clash_on_constructor.dart:8:8: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. | ||
// Foo<@x x>() {} | ||
// ^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
class Foo extends core::Object { | ||
constructor •() → self::Foo | ||
; | ||
} | ||
static const field core::int x = 42; |
25 changes: 25 additions & 0 deletions
25
...ess/annotation_on_type_parameter_name_clash_on_constructor.dart.strong.transformed.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/annotation_on_type_parameter_name_clash_on_constructor.dart:8:6: Error: Constructors can't have type parameters. | ||
// Try removing the type parameters. | ||
// Foo<@x x>() {} | ||
// ^^^^^^ | ||
// | ||
// pkg/front_end/testcases/regress/annotation_on_type_parameter_name_clash_on_constructor.dart:8:8: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor. | ||
// Foo<@x x>() {} | ||
// ^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
class Foo extends core::Object { | ||
constructor •() → self::Foo | ||
: super core::Object::•() {} | ||
} | ||
static const field core::int x = #C1; | ||
|
||
constants { | ||
#C1 = 42 | ||
} |
5 changes: 5 additions & 0 deletions
5
...egress/annotation_on_type_parameter_name_clash_on_constructor.dart.textual_outline.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const int x = 42; | ||
|
||
class Foo { | ||
Foo<@x x>() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters