Skip to content

Commit

Permalink
Version 3.3.0-88.0.dev
Browse files Browse the repository at this point in the history
Merge 1afa57f into dev
  • Loading branch information
Dart CI committed Nov 1, 2023
2 parents e6df03a + 1afa57f commit a11b7ca
Show file tree
Hide file tree
Showing 23 changed files with 480 additions and 235 deletions.
20 changes: 17 additions & 3 deletions pkg/front_end/lib/src/fasta/source/outline_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2816,15 +2816,29 @@ class OutlineBuilder extends StackListenerImpl {
}
}
}
if (formals == null &&
declarationContext == DeclarationContext.ExtensionType &&
kind == MemberKind.PrimaryConstructor) {
if (declarationContext == DeclarationContext.ExtensionType &&
kind == MemberKind.PrimaryConstructor &&
formals == null) {
// In case of primary constructors of extension types, an error is
// reported by the parser if the formals together with the parentheses
// around them are missing. To distinguish that case from the case of the
// formal parameters present, but lacking the representation field, we
// pass the empty list further along instead of `null`.
formals = const [];
} else if ((declarationContext == DeclarationContext.ExtensionType &&
kind == MemberKind.PrimaryConstructor ||
declarationContext ==
DeclarationContext.ExtensionTypeConstructor) &&
formals != null) {
for (FormalParameterBuilder formal in formals) {
if (formal.isSuperInitializingFormal) {
libraryBuilder.addProblem(
messageExtensionTypeConstructorWithSuperFormalParameter,
formal.charOffset,
formal.name.length,
formal.fileUri);
}
}
}
push(beginToken.charOffset);
push(formals ?? NullValues.FormalParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import '../messages.dart'
show
LocatedMessage,
Message,
messageExtensionTypeConstructorWithSuperFormalParameter,
messageMoreThanOneSuperInitializer,
messageRedirectingConstructorWithAnotherInitializer,
messageRedirectingConstructorWithMultipleRedirectInitializers,
Expand Down Expand Up @@ -1176,11 +1175,6 @@ class SourceExtensionTypeConstructorBuilder
if (formal.isSuperInitializingFormal) {
TypeBuilder formalTypeBuilder = formal.type;
if (formalTypeBuilder is InferableTypeBuilder) {
libraryBuilder.addProblem(
messageExtensionTypeConstructorWithSuperFormalParameter,
formal.charOffset,
formal.name.length,
formal.fileUri);
formalTypeBuilder.registerType(const InvalidType());
}
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/front_end/testcases/extension_types/issue53212.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ extension type E2(int foo) {
extension type E3(int foo) {
E3.named(this.foo, [super.bar = null]);
}

extension type E4(super.foo) {} // Error.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ library;
// E3.named(this.foo, [super.bar = null]);
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Extension type constructors can't declare super formal parameters.
// extension type E4(super.foo) {} // Error.
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Expected a representation type.
// extension type E4(super.foo) {} // Error.
// ^^^
//
import self as self;
import "dart:core" as core;

Expand All @@ -38,6 +46,11 @@ extension type E3(core::int foo) {
constructor named = self::E3|constructor#named;
constructor tearoff named = self::E3|constructor#_#named#tearOff;
}
extension type E4(dynamic foo) {
abstract inline-class-member representation-field get foo() → dynamic;
constructor • = self::E4|constructor#;
constructor tearoff • = self::E4|constructor#_#new#tearOff;
}
static inline-class-member method E1|constructor#(core::int foo) → self::E1 /* = core::int */ {
lowered final self::E1 /* = core::int */ #this = foo;
return #this;
Expand Down Expand Up @@ -74,6 +87,12 @@ static inline-class-member method E3|constructor#named(core::int foo, [has-decla
}
static inline-class-member method E3|constructor#_#named#tearOff(core::int foo, [has-declared-initializer invalid-type bar]) → self::E3 /* = core::int */
return self::E3|constructor#named(foo, bar);
static inline-class-member method E4|constructor#(dynamic foo) → self::E4 /* = dynamic */ {
lowered final self::E4 /* = dynamic */ #this = foo;
return #this;
}
static inline-class-member method E4|constructor#_#new#tearOff(dynamic foo) → self::E4 /* = dynamic */
return self::E4|constructor#(foo);

constants {
#C1 = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ library;
// E3.named(this.foo, [super.bar = null]);
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Extension type constructors can't declare super formal parameters.
// extension type E4(super.foo) {} // Error.
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Expected a representation type.
// extension type E4(super.foo) {} // Error.
// ^^^
//
import self as self;
import "dart:core" as core;

Expand All @@ -38,6 +46,11 @@ extension type E3(core::int foo) {
constructor named = self::E3|constructor#named;
constructor tearoff named = self::E3|constructor#_#named#tearOff;
}
extension type E4(dynamic foo) {
abstract inline-class-member representation-field get foo() → dynamic;
constructor • = self::E4|constructor#;
constructor tearoff • = self::E4|constructor#_#new#tearOff;
}
static inline-class-member method E1|constructor#(core::int foo) → self::E1 /* = core::int */ {
lowered final self::E1 /* = core::int */ #this = foo;
return #this;
Expand Down Expand Up @@ -74,6 +87,12 @@ static inline-class-member method E3|constructor#named(core::int foo, [has-decla
}
static inline-class-member method E3|constructor#_#named#tearOff(core::int foo, [has-declared-initializer invalid-type bar]) → self::E3 /* = core::int */
return self::E3|constructor#named(foo, bar);
static inline-class-member method E4|constructor#(dynamic foo) → self::E4 /* = dynamic */ {
lowered final self::E4 /* = dynamic */ #this = foo;
return #this;
}
static inline-class-member method E4|constructor#_#new#tearOff(dynamic foo) → self::E4 /* = dynamic */
return self::E4|constructor#(foo);

constants {
#C1 = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ extension type E2(int foo) {
extension type E3(int foo) {
E3.named(this.foo, [super.bar = null]);
}
extension type E4(super.foo) {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ extension type E2(int foo) {
extension type E3(int foo) {
E3.named(this.foo, [super.bar = null]);
}
extension type E4(super.foo) {}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ library;
// E3.named(this.foo, [super.bar = null]);
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Extension type constructors can't declare super formal parameters.
// extension type E4(super.foo) {} // Error.
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Expected a representation type.
// extension type E4(super.foo) {} // Error.
// ^^^
//
import self as self;
import "dart:core" as core;

Expand All @@ -38,6 +46,11 @@ extension type E3(core::int foo) {
constructor named = self::E3|constructor#named;
constructor tearoff named = self::E3|constructor#_#named#tearOff;
}
extension type E4(dynamic foo) {
abstract inline-class-member representation-field get foo() → dynamic;
constructor • = self::E4|constructor#;
constructor tearoff • = self::E4|constructor#_#new#tearOff;
}
static inline-class-member method E1|constructor#(core::int foo) → self::E1 /* = core::int */ {
lowered final self::E1 /* = core::int */ #this = foo;
return #this;
Expand Down Expand Up @@ -74,6 +87,12 @@ static inline-class-member method E3|constructor#named(core::int foo, [has-decla
}
static inline-class-member method E3|constructor#_#named#tearOff(core::int foo, [has-declared-initializer invalid-type bar]) → self::E3 /* = core::int */
return self::E3|constructor#named(foo, bar);
static inline-class-member method E4|constructor#(dynamic foo) → self::E4 /* = dynamic */ {
lowered final self::E4 /* = dynamic */ #this = foo;
return #this;
}
static inline-class-member method E4|constructor#_#new#tearOff(dynamic foo) → self::E4 /* = dynamic */
return self::E4|constructor#(foo);

constants {
#C1 = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ library;
// E3.named(this.foo, [super.bar = null]);
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Extension type constructors can't declare super formal parameters.
// extension type E4(super.foo) {} // Error.
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Expected a representation type.
// extension type E4(super.foo) {} // Error.
// ^^^
//
import self as self;
import "dart:core" as core;

Expand All @@ -38,6 +46,11 @@ extension type E3(core::int foo) {
constructor named = self::E3|constructor#named;
constructor tearoff named = self::E3|constructor#_#named#tearOff;
}
extension type E4(dynamic foo) {
abstract inline-class-member representation-field get foo() → dynamic;
constructor • = self::E4|constructor#;
constructor tearoff • = self::E4|constructor#_#new#tearOff;
}
static inline-class-member method E1|constructor#(core::int foo) → self::E1 /* = core::int */ {
lowered final self::E1 /* = core::int */ #this = foo;
return #this;
Expand Down Expand Up @@ -74,6 +87,12 @@ static inline-class-member method E3|constructor#named(core::int foo, [has-decla
}
static inline-class-member method E3|constructor#_#named#tearOff(core::int foo, [has-declared-initializer invalid-type bar]) → self::E3 /* = core::int */
return self::E3|constructor#named(foo, bar);
static inline-class-member method E4|constructor#(dynamic foo) → self::E4 /* = dynamic */ {
lowered final self::E4 /* = dynamic */ #this = foo;
return #this;
}
static inline-class-member method E4|constructor#_#new#tearOff(dynamic foo) → self::E4 /* = dynamic */
return self::E4|constructor#(foo);

constants {
#C1 = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ library;
// E3.named(this.foo, [super.bar = null]);
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Extension type constructors can't declare super formal parameters.
// extension type E4(super.foo) {} // Error.
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Expected a representation type.
// extension type E4(super.foo) {} // Error.
// ^^^
//
import self as self;
import "dart:core" as core;

Expand All @@ -38,6 +46,11 @@ extension type E3(core::int foo) {
constructor named = self::E3|constructor#named;
constructor tearoff named = self::E3|constructor#_#named#tearOff;
}
extension type E4(dynamic foo) {
abstract inline-class-member representation-field get foo() → dynamic;
constructor • = self::E4|constructor#;
constructor tearoff • = self::E4|constructor#_#new#tearOff;
}
static inline-class-member method E1|constructor#(core::int foo) → self::E1 /* = core::int */
;
static inline-class-member method E1|constructor#_#new#tearOff(core::int foo) → self::E1 /* = core::int */
Expand All @@ -62,3 +75,7 @@ static inline-class-member method E3|constructor#named(core::int foo, [has-decla
;
static inline-class-member method E3|constructor#_#named#tearOff(core::int foo, [has-declared-initializer invalid-type bar]) → self::E3 /* = core::int */
return self::E3|constructor#named(foo, bar);
static inline-class-member method E4|constructor#(dynamic foo) → self::E4 /* = dynamic */
;
static inline-class-member method E4|constructor#_#new#tearOff(dynamic foo) → self::E4 /* = dynamic */
return self::E4|constructor#(foo);
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ library;
// E3.named(this.foo, [super.bar = null]);
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Extension type constructors can't declare super formal parameters.
// extension type E4(super.foo) {} // Error.
// ^^^
//
// pkg/front_end/testcases/extension_types/issue53212.dart:17:25: Error: Expected a representation type.
// extension type E4(super.foo) {} // Error.
// ^^^
//
import self as self;
import "dart:core" as core;

Expand All @@ -38,6 +46,11 @@ extension type E3(core::int foo) {
constructor named = self::E3|constructor#named;
constructor tearoff named = self::E3|constructor#_#named#tearOff;
}
extension type E4(dynamic foo) {
abstract inline-class-member representation-field get foo() → dynamic;
constructor • = self::E4|constructor#;
constructor tearoff • = self::E4|constructor#_#new#tearOff;
}
static inline-class-member method E1|constructor#(core::int foo) → self::E1 /* = core::int */ {
lowered final self::E1 /* = core::int */ #this = foo;
return #this;
Expand Down Expand Up @@ -74,6 +87,12 @@ static inline-class-member method E3|constructor#named(core::int foo, [has-decla
}
static inline-class-member method E3|constructor#_#named#tearOff(core::int foo, [has-declared-initializer invalid-type bar]) → self::E3 /* = core::int */
return self::E3|constructor#named(foo, bar);
static inline-class-member method E4|constructor#(dynamic foo) → self::E4 /* = dynamic */ {
lowered final self::E4 /* = dynamic */ #this = foo;
return #this;
}
static inline-class-member method E4|constructor#_#new#tearOff(dynamic foo) → self::E4 /* = dynamic */
return self::E4|constructor#(foo);

constants {
#C1 = null
Expand Down
37 changes: 13 additions & 24 deletions runtime/tests/vm/dart/address_local_pointer_il_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,21 @@ import 'package:vm/testing/il_matchers.dart';
int identity(int address) => Pointer<Void>.fromAddress(address).address;

void matchIL$identity(FlowGraph graph) {
graph.dump();
if (is32BitConfiguration) {
// The Dart int address is truncated before being returned.
graph.match([
match.block('Graph'),
match.block('Function', [
'address' << match.Parameter(index: 0),
'int32' <<
match.IntConverter('address',
from: 'int64', to: 'int32', is_truncating: true),
final retval = is32BitConfiguration ? 'retval' : 'address';
graph.match([
match.block('Graph'),
match.block('Function', [
'address' << match.Parameter(index: 0),
if (is32BitConfiguration) ...[
// The Dart int address is truncated before being returned.
'uint32' <<
match.IntConverter('int32',
from: 'int32', to: 'uint32', is_truncating: true),
match.IntConverter('address',
from: 'int64', to: 'uint32', is_truncating: true),
'retval' << match.IntConverter('uint32', from: 'uint32', to: 'int64'),
match.Return('retval'),
]),
]);
} else {
graph.match([
match.block('Graph'),
match.block('Function', [
'address' << match.Parameter(index: 0),
match.Return('address'),
]),
]);
}
],
match.Return(retval),
]),
]);
}

void main(List<String> args) {
Expand Down
7 changes: 1 addition & 6 deletions runtime/tests/vm/dart/regress_306327173_il_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@ void matchIL$deref(FlowGraph graph) {
// and int64 on 64-bit arches.
if (is32BitConfiguration) ...[
// 'unboxed' needs to be converted to int64 before returning.
//
// Note: The first two conversions here should be fixed once all
// kUnboxedIntPtr uses are appropriately converted to kUnboxedFfiIntPtr.
'extra1' << match.IntConverter('unboxed', from: 'uint32', to: 'int32'),
'extra2' << match.IntConverter('extra1', from: 'int32', to: 'uint32'),
'address' << match.IntConverter('extra2', from: 'uint32', to: 'int64'),
'address' << match.IntConverter('unboxed', from: 'uint32', to: 'int64'),
],
match.Return(retvalName),
]),
Expand Down
Loading

0 comments on commit a11b7ca

Please sign in to comment.