-
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] Fix crash on abstracty field with duplicate initializer
Change-Id: I8b33ab973ad0849c36ccec6b6136d53f1b1b2cd0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397761 Commit-Queue: Jens Johansen <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
- Loading branch information
Showing
8 changed files
with
140 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
8 changes: 8 additions & 0 deletions
8
pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.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,8 @@ | ||
// 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. | ||
|
||
abstract class Foo { | ||
abstract int foo; | ||
Foo(this.foo, this.foo) {} | ||
} |
34 changes: 34 additions & 0 deletions
34
pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.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,34 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:22: Error: Duplicated parameter name 'foo'. | ||
// Foo(this.foo, this.foo) {} | ||
// ^^^ | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:12: Context: Other parameter named 'foo'. | ||
// Foo(this.foo, this.foo) {} | ||
// ^^^ | ||
// | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:12: Error: Abstract fields cannot have initializers. | ||
// Try removing the field initializer or the 'abstract' keyword from the field declaration. | ||
// Foo(this.foo, this.foo) {} | ||
// ^^^ | ||
// | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:22: Error: 'foo' was already initialized by this constructor. | ||
// Foo(this.foo, this.foo) {} | ||
// ^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class Foo extends core::Object { | ||
constructor •(core::int foo, core::int foo) → self::Foo | ||
: final dynamic #t1 = invalid-expression "pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:12: Error: Abstract fields cannot have initializers. | ||
Try removing the field initializer or the 'abstract' keyword from the field declaration. | ||
Foo(this.foo, this.foo) {} | ||
^^^", final dynamic #t2 = invalid-expression "pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:22: Error: 'foo' was already initialized by this constructor. | ||
Foo(this.foo, this.foo) {} | ||
^" {} | ||
abstract get foo() → core::int; | ||
abstract set foo(synthesized core::int #externalFieldValue) → void; | ||
} |
34 changes: 34 additions & 0 deletions
34
...ont_end/testcases/regress/abstract_field_duplicate_initializer.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,34 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:22: Error: Duplicated parameter name 'foo'. | ||
// Foo(this.foo, this.foo) {} | ||
// ^^^ | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:12: Context: Other parameter named 'foo'. | ||
// Foo(this.foo, this.foo) {} | ||
// ^^^ | ||
// | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:12: Error: Abstract fields cannot have initializers. | ||
// Try removing the field initializer or the 'abstract' keyword from the field declaration. | ||
// Foo(this.foo, this.foo) {} | ||
// ^^^ | ||
// | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:22: Error: 'foo' was already initialized by this constructor. | ||
// Foo(this.foo, this.foo) {} | ||
// ^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class Foo extends core::Object { | ||
constructor •(core::int foo, core::int foo) → self::Foo | ||
: final dynamic #t1 = invalid-expression "pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:12: Error: Abstract fields cannot have initializers. | ||
Try removing the field initializer or the 'abstract' keyword from the field declaration. | ||
Foo(this.foo, this.foo) {} | ||
^^^", final dynamic #t2 = invalid-expression "pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:22: Error: 'foo' was already initialized by this constructor. | ||
Foo(this.foo, this.foo) {} | ||
^" {} | ||
abstract get foo() → core::int; | ||
abstract set foo(synthesized core::int #externalFieldValue) → void; | ||
} |
20 changes: 20 additions & 0 deletions
20
...ont_end/testcases/regress/abstract_field_duplicate_initializer.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,20 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:22: Error: Duplicated parameter name 'foo'. | ||
// Foo(this.foo, this.foo) {} | ||
// ^^^ | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:12: Context: Other parameter named 'foo'. | ||
// Foo(this.foo, this.foo) {} | ||
// ^^^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class Foo extends core::Object { | ||
constructor •(core::int foo, core::int foo) → self::Foo | ||
; | ||
abstract get foo() → core::int; | ||
abstract set foo(synthesized core::int #externalFieldValue) → void; | ||
} |
34 changes: 34 additions & 0 deletions
34
...end/testcases/regress/abstract_field_duplicate_initializer.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,34 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:22: Error: Duplicated parameter name 'foo'. | ||
// Foo(this.foo, this.foo) {} | ||
// ^^^ | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:12: Context: Other parameter named 'foo'. | ||
// Foo(this.foo, this.foo) {} | ||
// ^^^ | ||
// | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:12: Error: Abstract fields cannot have initializers. | ||
// Try removing the field initializer or the 'abstract' keyword from the field declaration. | ||
// Foo(this.foo, this.foo) {} | ||
// ^^^ | ||
// | ||
// pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:22: Error: 'foo' was already initialized by this constructor. | ||
// Foo(this.foo, this.foo) {} | ||
// ^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class Foo extends core::Object { | ||
constructor •(core::int foo, core::int foo) → self::Foo | ||
: final dynamic #t1 = invalid-expression "pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:12: Error: Abstract fields cannot have initializers. | ||
Try removing the field initializer or the 'abstract' keyword from the field declaration. | ||
Foo(this.foo, this.foo) {} | ||
^^^", final dynamic #t2 = invalid-expression "pkg/front_end/testcases/regress/abstract_field_duplicate_initializer.dart:7:22: Error: 'foo' was already initialized by this constructor. | ||
Foo(this.foo, this.foo) {} | ||
^" {} | ||
abstract get foo() → core::int; | ||
abstract set foo(synthesized core::int #externalFieldValue) → void; | ||
} |
4 changes: 4 additions & 0 deletions
4
...nt_end/testcases/regress/abstract_field_duplicate_initializer.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,4 @@ | ||
abstract class Foo { | ||
abstract int foo; | ||
Foo(this.foo, this.foo) {} | ||
} |
4 changes: 4 additions & 0 deletions
4
...stcases/regress/abstract_field_duplicate_initializer.dart.textual_outline_modelled.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,4 @@ | ||
abstract class Foo { | ||
Foo(this.foo, this.foo) {} | ||
abstract int foo; | ||
} |