-
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 in extension type declared instance field type pointi…
…ng to method Change-Id: I6d1d34f487d0095c306c3144e61cca7bd4bc559d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397920 Commit-Queue: Jens Johansen <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
- Loading branch information
Showing
8 changed files
with
131 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/extension_type_field_has_method_type.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. | ||
|
||
extension Foo on int { | ||
bar(){} | ||
bar baz; | ||
} |
28 changes: 28 additions & 0 deletions
28
pkg/front_end/testcases/regress/extension_type_field_has_method_type.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,28 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:7:7: Error: Extensions can't declare instance fields | ||
// Try removing the field declaration or making it a static field | ||
// bar baz; | ||
// ^^^ | ||
// | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:7:3: Error: 'bar' isn't a type. | ||
// bar baz; | ||
// ^^^ | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:6:3: Context: This isn't a type. | ||
// bar(){} | ||
// ^^^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
extension Foo on core::int { | ||
method bar = self::Foo|bar; | ||
method tearoff bar = self::Foo|get#bar; | ||
field baz = self::Foo|baz; | ||
} | ||
static field invalid-type Foo|baz; | ||
static extension-member method Foo|bar(lowered final core::int #this) → dynamic {} | ||
static extension-member method Foo|get#bar(lowered final core::int #this) → () → dynamic | ||
return () → dynamic => self::Foo|bar(#this); |
28 changes: 28 additions & 0 deletions
28
...ont_end/testcases/regress/extension_type_field_has_method_type.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,28 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:7:7: Error: Extensions can't declare instance fields | ||
// Try removing the field declaration or making it a static field | ||
// bar baz; | ||
// ^^^ | ||
// | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:7:3: Error: 'bar' isn't a type. | ||
// bar baz; | ||
// ^^^ | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:6:3: Context: This isn't a type. | ||
// bar(){} | ||
// ^^^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
extension Foo on core::int { | ||
method bar = self::Foo|bar; | ||
method tearoff bar = self::Foo|get#bar; | ||
field baz = self::Foo|baz; | ||
} | ||
static field invalid-type Foo|baz; | ||
static extension-member method Foo|bar(lowered final core::int #this) → dynamic {} | ||
static extension-member method Foo|get#bar(lowered final core::int #this) → () → dynamic | ||
return () → dynamic => self::Foo|bar(#this); |
29 changes: 29 additions & 0 deletions
29
...ont_end/testcases/regress/extension_type_field_has_method_type.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,29 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:7:7: Error: Extensions can't declare instance fields | ||
// Try removing the field declaration or making it a static field | ||
// bar baz; | ||
// ^^^ | ||
// | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:7:3: Error: 'bar' isn't a type. | ||
// bar baz; | ||
// ^^^ | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:6:3: Context: This isn't a type. | ||
// bar(){} | ||
// ^^^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
extension Foo on core::int { | ||
method bar = self::Foo|bar; | ||
method tearoff bar = self::Foo|get#bar; | ||
field baz = self::Foo|baz; | ||
} | ||
static field invalid-type Foo|baz; | ||
static extension-member method Foo|bar(lowered final core::int #this) → dynamic | ||
; | ||
static extension-member method Foo|get#bar(lowered final core::int #this) → () → dynamic | ||
return () → dynamic => self::Foo|bar(#this); |
28 changes: 28 additions & 0 deletions
28
...end/testcases/regress/extension_type_field_has_method_type.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,28 @@ | ||
library; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:7:7: Error: Extensions can't declare instance fields | ||
// Try removing the field declaration or making it a static field | ||
// bar baz; | ||
// ^^^ | ||
// | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:7:3: Error: 'bar' isn't a type. | ||
// bar baz; | ||
// ^^^ | ||
// pkg/front_end/testcases/regress/extension_type_field_has_method_type.dart:6:3: Context: This isn't a type. | ||
// bar(){} | ||
// ^^^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
extension Foo on core::int { | ||
method bar = self::Foo|bar; | ||
method tearoff bar = self::Foo|get#bar; | ||
field baz = self::Foo|baz; | ||
} | ||
static field invalid-type Foo|baz; | ||
static extension-member method Foo|bar(lowered final core::int #this) → dynamic {} | ||
static extension-member method Foo|get#bar(lowered final core::int #this) → () → dynamic | ||
return () → dynamic => self::Foo|bar(#this); |
4 changes: 4 additions & 0 deletions
4
...nt_end/testcases/regress/extension_type_field_has_method_type.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 @@ | ||
extension Foo on int { | ||
bar(){} | ||
bar baz; | ||
} |
4 changes: 4 additions & 0 deletions
4
...stcases/regress/extension_type_field_has_method_type.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 @@ | ||
extension Foo on int { | ||
bar(){} | ||
bar baz; | ||
} |