From 8d8c4c6125054cec81fd1e025bbd5a02d556d666 Mon Sep 17 00:00:00 2001 From: Johnni Winther Date: Tue, 19 Dec 2023 08:43:56 +0000 Subject: [PATCH] [cfe] Handle extension types in *Concatenation nodes Closes #54357 Change-Id: Ie5ff5c6c61c537658dcc6715054ff82c6f8537c4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341961 Reviewed-by: Jens Johansen Commit-Queue: Johnni Winther --- .../src/fasta/kernel/constant_evaluator.dart | 34 +++++++++- .../test/spell_checking_list_tests.txt | 2 + .../testcases/extension_types/issue54357.dart | 32 +++++++++ .../issue54357.dart.strong.expect | 55 ++++++++++++++++ .../issue54357.dart.strong.transformed.expect | 55 ++++++++++++++++ .../issue54357.dart.textual_outline.expect | 24 +++++++ ...54357.dart.textual_outline_modelled.expect | 24 +++++++ .../issue54357.dart.weak.expect | 55 ++++++++++++++++ .../issue54357.dart.weak.modular.expect | 55 ++++++++++++++++ .../issue54357.dart.weak.outline.expect | 65 +++++++++++++++++++ .../issue54357.dart.weak.transformed.expect | 55 ++++++++++++++++ 11 files changed, 453 insertions(+), 3 deletions(-) create mode 100644 pkg/front_end/testcases/extension_types/issue54357.dart create mode 100644 pkg/front_end/testcases/extension_types/issue54357.dart.strong.expect create mode 100644 pkg/front_end/testcases/extension_types/issue54357.dart.strong.transformed.expect create mode 100644 pkg/front_end/testcases/extension_types/issue54357.dart.textual_outline.expect create mode 100644 pkg/front_end/testcases/extension_types/issue54357.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/extension_types/issue54357.dart.weak.expect create mode 100644 pkg/front_end/testcases/extension_types/issue54357.dart.weak.modular.expect create mode 100644 pkg/front_end/testcases/extension_types/issue54357.dart.weak.outline.expect create mode 100644 pkg/front_end/testcases/extension_types/issue54357.dart.weak.transformed.expect diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart index d2974548b9a5..3598762fb1fb 100644 --- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart +++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart @@ -3089,8 +3089,15 @@ class ConstantEvaluator implements ExpressionVisitor { @override Constant visitListConcatenation(ListConcatenation node) { + DartType? type = _evaluateDartType(node, node.typeArgument); + if (type == null) { + AbortConstant error = _gotError!; + _gotError = null; + return error; + } + assert(_gotError == null); final ListConstantBuilder builder = - new ListConstantBuilder(node, convertType(node.typeArgument), this); + new ListConstantBuilder(node, convertType(type), this); for (Expression list in node.lists) { AbortConstant? error = builder.addSpread(list); if (error != null) return error; @@ -3134,8 +3141,15 @@ class ConstantEvaluator implements ExpressionVisitor { @override Constant visitSetConcatenation(SetConcatenation node) { + DartType? type = _evaluateDartType(node, node.typeArgument); + if (type == null) { + AbortConstant error = _gotError!; + _gotError = null; + return error; + } + assert(_gotError == null); final SetConstantBuilder builder = - new SetConstantBuilder(node, convertType(node.typeArgument), this); + new SetConstantBuilder(node, convertType(type), this); for (Expression set_ in node.sets) { AbortConstant? error = builder.addSpread(set_); if (error != null) return error; @@ -3187,8 +3201,22 @@ class ConstantEvaluator implements ExpressionVisitor { @override Constant visitMapConcatenation(MapConcatenation node) { + DartType? keyType = _evaluateDartType(node, node.keyType); + if (keyType == null) { + AbortConstant error = _gotError!; + _gotError = null; + return error; + } + assert(_gotError == null); + DartType? valueType = _evaluateDartType(node, node.valueType); + if (valueType == null) { + AbortConstant error = _gotError!; + _gotError = null; + return error; + } + assert(_gotError == null); final MapConstantBuilder builder = new MapConstantBuilder( - node, convertType(node.keyType), convertType(node.valueType), this); + node, convertType(keyType), convertType(valueType), this); for (Expression map in node.maps) { AbortConstant? error = builder.addSpread(map); if (error != null) return error; diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt index f82320359f96..13d2e37310d9 100644 --- a/pkg/front_end/test/spell_checking_list_tests.txt +++ b/pkg/front_end/test/spell_checking_list_tests.txt @@ -285,6 +285,7 @@ estat et everytime evicting +ex examines exceed excess @@ -705,6 +706,7 @@ splitting spurious sqrt squared +ss sssp stacks stashed diff --git a/pkg/front_end/testcases/extension_types/issue54357.dart b/pkg/front_end/testcases/extension_types/issue54357.dart new file mode 100644 index 000000000000..909d1ee7928f --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue54357.dart @@ -0,0 +1,32 @@ +// Copyright (c) 2023, 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 ex3 = ExInt(3); +const ex4 = ExInt(4); + +const l3 = [ex3]; +const l4 = [ex4]; +const l34i = [ex3 as int, ... l4 as List]; +const l43 = [ex4, ex3]; +const l3s4 = [ex3, ... l4]; +const ls43 = [... l4, ex3]; +const ls3s4 = [... l3, ... l4]; + +const s3 = {ex3}; +const s4 = {ex4}; +const s34i = {ex3 as int, ... s4 as Set}; +const s43 = {ex4, ex3}; +const s3s4 = {ex3, ... s4}; +const ss43 = {... s4, ex3}; +const ss3s4 = {... s3, ... s4}; + +const m3 = {ex3: ex3}; +const m4 = {ex4: ex4}; +const m34i = {ex3 as int: ex3 as int, ... m4 as Map}; +const m43 = {ex4: ex4, ex3: ex3}; +const m3s4 = {ex3: ex3, ... m4}; +const ms43 = {... m4, ex3: ex3}; +const ms3s4 = {... m3, ... m4}; + +extension type const ExInt(int _) implements int {} diff --git a/pkg/front_end/testcases/extension_types/issue54357.dart.strong.expect b/pkg/front_end/testcases/extension_types/issue54357.dart.strong.expect new file mode 100644 index 000000000000..b01f82571b31 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue54357.dart.strong.expect @@ -0,0 +1,55 @@ +library; +import self as self; +import "dart:core" as core; + +extension type ExInt(core::int _) implements core::int { + abstract extension-type-member representation-field get _() → core::int; + constructor • = self::ExInt|constructor#; + constructor tearoff • = self::ExInt|constructor#_#new#tearOff; +} +static const field self::ExInt /* = core::int */ ex3 = #C1; +static const field self::ExInt /* = core::int */ ex4 = #C2; +static const field core::List l3 = #C3; +static const field core::List l4 = #C4; +static const field core::List l34i = #C5; +static const field core::List l43 = #C6; +static const field core::List l3s4 = #C5; +static const field core::List ls43 = #C6; +static const field core::List ls3s4 = #C5; +static const field core::Set s3 = #C7; +static const field core::Set s4 = #C8; +static const field core::Set s34i = #C9; +static const field core::Set s43 = #C10; +static const field core::Set s3s4 = #C9; +static const field core::Set ss43 = #C10; +static const field core::Set ss3s4 = #C9; +static const field core::Map m3 = #C11; +static const field core::Map m4 = #C12; +static const field core::Map m34i = #C13; +static const field core::Map m43 = #C14; +static const field core::Map m3s4 = #C13; +static const field core::Map ms43 = #C14; +static const field core::Map ms3s4 = #C13; +static extension-type-member method ExInt|constructor#(core::int _) → self::ExInt /* = core::int */ { + lowered final self::ExInt /* = core::int */ #this = _; + return #this; +} +static extension-type-member method ExInt|constructor#_#new#tearOff(core::int _) → self::ExInt /* = core::int */ + return self::ExInt|constructor#(_); + +constants { + #C1 = 3 + #C2 = 4 + #C3 = [#C1] + #C4 = [#C2] + #C5 = [#C1, #C2] + #C6 = [#C2, #C1] + #C7 = {#C1} + #C8 = {#C2} + #C9 = {#C1, #C2} + #C10 = {#C2, #C1} + #C11 = {#C1:#C1} + #C12 = {#C2:#C2} + #C13 = {#C1:#C1, #C2:#C2} + #C14 = {#C2:#C2, #C1:#C1} +} diff --git a/pkg/front_end/testcases/extension_types/issue54357.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/issue54357.dart.strong.transformed.expect new file mode 100644 index 000000000000..b01f82571b31 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue54357.dart.strong.transformed.expect @@ -0,0 +1,55 @@ +library; +import self as self; +import "dart:core" as core; + +extension type ExInt(core::int _) implements core::int { + abstract extension-type-member representation-field get _() → core::int; + constructor • = self::ExInt|constructor#; + constructor tearoff • = self::ExInt|constructor#_#new#tearOff; +} +static const field self::ExInt /* = core::int */ ex3 = #C1; +static const field self::ExInt /* = core::int */ ex4 = #C2; +static const field core::List l3 = #C3; +static const field core::List l4 = #C4; +static const field core::List l34i = #C5; +static const field core::List l43 = #C6; +static const field core::List l3s4 = #C5; +static const field core::List ls43 = #C6; +static const field core::List ls3s4 = #C5; +static const field core::Set s3 = #C7; +static const field core::Set s4 = #C8; +static const field core::Set s34i = #C9; +static const field core::Set s43 = #C10; +static const field core::Set s3s4 = #C9; +static const field core::Set ss43 = #C10; +static const field core::Set ss3s4 = #C9; +static const field core::Map m3 = #C11; +static const field core::Map m4 = #C12; +static const field core::Map m34i = #C13; +static const field core::Map m43 = #C14; +static const field core::Map m3s4 = #C13; +static const field core::Map ms43 = #C14; +static const field core::Map ms3s4 = #C13; +static extension-type-member method ExInt|constructor#(core::int _) → self::ExInt /* = core::int */ { + lowered final self::ExInt /* = core::int */ #this = _; + return #this; +} +static extension-type-member method ExInt|constructor#_#new#tearOff(core::int _) → self::ExInt /* = core::int */ + return self::ExInt|constructor#(_); + +constants { + #C1 = 3 + #C2 = 4 + #C3 = [#C1] + #C4 = [#C2] + #C5 = [#C1, #C2] + #C6 = [#C2, #C1] + #C7 = {#C1} + #C8 = {#C2} + #C9 = {#C1, #C2} + #C10 = {#C2, #C1} + #C11 = {#C1:#C1} + #C12 = {#C2:#C2} + #C13 = {#C1:#C1, #C2:#C2} + #C14 = {#C2:#C2, #C1:#C1} +} diff --git a/pkg/front_end/testcases/extension_types/issue54357.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/issue54357.dart.textual_outline.expect new file mode 100644 index 000000000000..8440e4af5e84 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue54357.dart.textual_outline.expect @@ -0,0 +1,24 @@ +const ex3 = ExInt(3); +const ex4 = ExInt(4); +const l3 = [ex3]; +const l4 = [ex4]; +const l34i = [ex3 as int, ...l4 as List]; +const l43 = [ex4, ex3]; +const l3s4 = [ex3, ...l4]; +const ls43 = [...l4, ex3]; +const ls3s4 = [...l3, ...l4]; +const s3 = {ex3}; +const s4 = {ex4}; +const s34i = {ex3 as int, ...s4 as Set}; +const s43 = {ex4, ex3}; +const s3s4 = {ex3, ...s4}; +const ss43 = {...s4, ex3}; +const ss3s4 = {...s3, ...s4}; +const m3 = {ex3: ex3}; +const m4 = {ex4: ex4}; +const m34i = {ex3 as int: ex3 as int, ...m4 as Map}; +const m43 = {ex4: ex4, ex3: ex3}; +const m3s4 = {ex3: ex3, ...m4}; +const ms43 = {...m4, ex3: ex3}; +const ms3s4 = {...m3, ...m4}; +extension type const ExInt(int _) implements int {} diff --git a/pkg/front_end/testcases/extension_types/issue54357.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/extension_types/issue54357.dart.textual_outline_modelled.expect new file mode 100644 index 000000000000..3dd2ad8de305 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue54357.dart.textual_outline_modelled.expect @@ -0,0 +1,24 @@ +const ex3 = ExInt(3); +const ex4 = ExInt(4); +const l3 = [ex3]; +const l34i = [ex3 as int, ...l4 as List]; +const l3s4 = [ex3, ...l4]; +const l4 = [ex4]; +const l43 = [ex4, ex3]; +const ls3s4 = [...l3, ...l4]; +const ls43 = [...l4, ex3]; +const m3 = {ex3: ex3}; +const m34i = {ex3 as int: ex3 as int, ...m4 as Map}; +const m3s4 = {ex3: ex3, ...m4}; +const m4 = {ex4: ex4}; +const m43 = {ex4: ex4, ex3: ex3}; +const ms3s4 = {...m3, ...m4}; +const ms43 = {...m4, ex3: ex3}; +const s3 = {ex3}; +const s34i = {ex3 as int, ...s4 as Set}; +const s3s4 = {ex3, ...s4}; +const s4 = {ex4}; +const s43 = {ex4, ex3}; +const ss3s4 = {...s3, ...s4}; +const ss43 = {...s4, ex3}; +extension type const ExInt(int _) implements int {} diff --git a/pkg/front_end/testcases/extension_types/issue54357.dart.weak.expect b/pkg/front_end/testcases/extension_types/issue54357.dart.weak.expect new file mode 100644 index 000000000000..6c9377e95aa7 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue54357.dart.weak.expect @@ -0,0 +1,55 @@ +library; +import self as self; +import "dart:core" as core; + +extension type ExInt(core::int _) implements core::int { + abstract extension-type-member representation-field get _() → core::int; + constructor • = self::ExInt|constructor#; + constructor tearoff • = self::ExInt|constructor#_#new#tearOff; +} +static const field self::ExInt /* = core::int */ ex3 = #C1; +static const field self::ExInt /* = core::int */ ex4 = #C2; +static const field core::List l3 = #C3; +static const field core::List l4 = #C4; +static const field core::List l34i = #C5; +static const field core::List l43 = #C6; +static const field core::List l3s4 = #C5; +static const field core::List ls43 = #C6; +static const field core::List ls3s4 = #C5; +static const field core::Set s3 = #C7; +static const field core::Set s4 = #C8; +static const field core::Set s34i = #C9; +static const field core::Set s43 = #C10; +static const field core::Set s3s4 = #C9; +static const field core::Set ss43 = #C10; +static const field core::Set ss3s4 = #C9; +static const field core::Map m3 = #C11; +static const field core::Map m4 = #C12; +static const field core::Map m34i = #C13; +static const field core::Map m43 = #C14; +static const field core::Map m3s4 = #C13; +static const field core::Map ms43 = #C14; +static const field core::Map ms3s4 = #C13; +static extension-type-member method ExInt|constructor#(core::int _) → self::ExInt /* = core::int */ { + lowered final self::ExInt /* = core::int */ #this = _; + return #this; +} +static extension-type-member method ExInt|constructor#_#new#tearOff(core::int _) → self::ExInt /* = core::int */ + return self::ExInt|constructor#(_); + +constants { + #C1 = 3 + #C2 = 4 + #C3 = [#C1] + #C4 = [#C2] + #C5 = [#C1, #C2] + #C6 = [#C2, #C1] + #C7 = {#C1} + #C8 = {#C2} + #C9 = {#C1, #C2} + #C10 = {#C2, #C1} + #C11 = {#C1:#C1} + #C12 = {#C2:#C2} + #C13 = {#C1:#C1, #C2:#C2} + #C14 = {#C2:#C2, #C1:#C1} +} diff --git a/pkg/front_end/testcases/extension_types/issue54357.dart.weak.modular.expect b/pkg/front_end/testcases/extension_types/issue54357.dart.weak.modular.expect new file mode 100644 index 000000000000..6c9377e95aa7 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue54357.dart.weak.modular.expect @@ -0,0 +1,55 @@ +library; +import self as self; +import "dart:core" as core; + +extension type ExInt(core::int _) implements core::int { + abstract extension-type-member representation-field get _() → core::int; + constructor • = self::ExInt|constructor#; + constructor tearoff • = self::ExInt|constructor#_#new#tearOff; +} +static const field self::ExInt /* = core::int */ ex3 = #C1; +static const field self::ExInt /* = core::int */ ex4 = #C2; +static const field core::List l3 = #C3; +static const field core::List l4 = #C4; +static const field core::List l34i = #C5; +static const field core::List l43 = #C6; +static const field core::List l3s4 = #C5; +static const field core::List ls43 = #C6; +static const field core::List ls3s4 = #C5; +static const field core::Set s3 = #C7; +static const field core::Set s4 = #C8; +static const field core::Set s34i = #C9; +static const field core::Set s43 = #C10; +static const field core::Set s3s4 = #C9; +static const field core::Set ss43 = #C10; +static const field core::Set ss3s4 = #C9; +static const field core::Map m3 = #C11; +static const field core::Map m4 = #C12; +static const field core::Map m34i = #C13; +static const field core::Map m43 = #C14; +static const field core::Map m3s4 = #C13; +static const field core::Map ms43 = #C14; +static const field core::Map ms3s4 = #C13; +static extension-type-member method ExInt|constructor#(core::int _) → self::ExInt /* = core::int */ { + lowered final self::ExInt /* = core::int */ #this = _; + return #this; +} +static extension-type-member method ExInt|constructor#_#new#tearOff(core::int _) → self::ExInt /* = core::int */ + return self::ExInt|constructor#(_); + +constants { + #C1 = 3 + #C2 = 4 + #C3 = [#C1] + #C4 = [#C2] + #C5 = [#C1, #C2] + #C6 = [#C2, #C1] + #C7 = {#C1} + #C8 = {#C2} + #C9 = {#C1, #C2} + #C10 = {#C2, #C1} + #C11 = {#C1:#C1} + #C12 = {#C2:#C2} + #C13 = {#C1:#C1, #C2:#C2} + #C14 = {#C2:#C2, #C1:#C1} +} diff --git a/pkg/front_end/testcases/extension_types/issue54357.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/issue54357.dart.weak.outline.expect new file mode 100644 index 000000000000..bd11aa0a459f --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue54357.dart.weak.outline.expect @@ -0,0 +1,65 @@ +library; +import self as self; +import "dart:core" as core; + +extension type ExInt(core::int _) implements core::int { + abstract extension-type-member representation-field get _() → core::int; + constructor • = self::ExInt|constructor#; + constructor tearoff • = self::ExInt|constructor#_#new#tearOff; +} +static const field self::ExInt /* = core::int */ ex3 = const self::ExInt|constructor#(3); +static const field self::ExInt /* = core::int */ ex4 = const self::ExInt|constructor#(4); +static const field core::List l3 = const [self::ex3]; +static const field core::List l4 = const [self::ex4]; +static const field core::List l34i = const [self::ex3 as core::int] + self::l4 as core::List; +static const field core::List l43 = const [self::ex4, self::ex3]; +static const field core::List l3s4 = const [self::ex3] + self::l4; +static const field core::List ls43 = self::l4 + const [self::ex3]; +static const field core::List ls3s4 = self::l3 + self::l4; +static const field core::Set s3 = const {self::ex3}; +static const field core::Set s4 = const {self::ex4}; +static const field core::Set s34i = const {self::ex3 as core::int} + self::s4 as core::Set; +static const field core::Set s43 = const {self::ex4, self::ex3}; +static const field core::Set s3s4 = const {self::ex3} + self::s4; +static const field core::Set ss43 = self::s4 + const {self::ex3}; +static const field core::Set ss3s4 = self::s3 + self::s4; +static const field core::Map m3 = const {self::ex3: self::ex3}; +static const field core::Map m4 = const {self::ex4: self::ex4}; +static const field core::Map m34i = const {self::ex3 as core::int: self::ex3 as core::int} + self::m4 as core::Map; +static const field core::Map m43 = const {self::ex4: self::ex4, self::ex3: self::ex3}; +static const field core::Map m3s4 = const {self::ex3: self::ex3} + self::m4; +static const field core::Map ms43 = self::m4 + const {self::ex3: self::ex3}; +static const field core::Map ms3s4 = self::m3 + self::m4; +static extension-type-member method ExInt|constructor#(core::int _) → self::ExInt /* = core::int */ { + lowered final self::ExInt /* = core::int */ #this = _; + return #this; +} +static extension-type-member method ExInt|constructor#_#new#tearOff(core::int _) → self::ExInt /* = core::int */ + return self::ExInt|constructor#(_); + + +Extra constant evaluation status: +Evaluated: FactoryConstructorInvocation @ org-dartlang-testcase:///issue54357.dart:5:13 -> IntConstant(3) +Evaluated: FactoryConstructorInvocation @ org-dartlang-testcase:///issue54357.dart:6:13 -> IntConstant(4) +Evaluated: ListLiteral @ org-dartlang-testcase:///issue54357.dart:8:12 -> ListConstant(const [3]) +Evaluated: ListLiteral @ org-dartlang-testcase:///issue54357.dart:9:12 -> ListConstant(const [4]) +Evaluated: ListConcatenation @ org-dartlang-testcase:///issue54357.dart:10:14 -> ListConstant(const [3, 4]) +Evaluated: ListLiteral @ org-dartlang-testcase:///issue54357.dart:11:13 -> ListConstant(const [4, 3]) +Evaluated: ListConcatenation @ org-dartlang-testcase:///issue54357.dart:12:14 -> ListConstant(const [3, 4]) +Evaluated: ListConcatenation @ org-dartlang-testcase:///issue54357.dart:13:14 -> ListConstant(const [4, 3]) +Evaluated: ListConcatenation @ org-dartlang-testcase:///issue54357.dart:14:15 -> ListConstant(const [3, 4]) +Evaluated: SetLiteral @ org-dartlang-testcase:///issue54357.dart:16:12 -> SetConstant(const {3}) +Evaluated: SetLiteral @ org-dartlang-testcase:///issue54357.dart:17:12 -> SetConstant(const {4}) +Evaluated: SetConcatenation @ org-dartlang-testcase:///issue54357.dart:18:14 -> SetConstant(const {3, 4}) +Evaluated: SetLiteral @ org-dartlang-testcase:///issue54357.dart:19:13 -> SetConstant(const {4, 3}) +Evaluated: SetConcatenation @ org-dartlang-testcase:///issue54357.dart:20:14 -> SetConstant(const {3, 4}) +Evaluated: SetConcatenation @ org-dartlang-testcase:///issue54357.dart:21:14 -> SetConstant(const {4, 3}) +Evaluated: SetConcatenation @ org-dartlang-testcase:///issue54357.dart:22:15 -> SetConstant(const {3, 4}) +Evaluated: MapLiteral @ org-dartlang-testcase:///issue54357.dart:24:12 -> MapConstant(const {3: 3}) +Evaluated: MapLiteral @ org-dartlang-testcase:///issue54357.dart:25:12 -> MapConstant(const {4: 4}) +Evaluated: MapConcatenation @ org-dartlang-testcase:///issue54357.dart:26:7 -> MapConstant(const {3: 3, 4: 4}) +Evaluated: MapLiteral @ org-dartlang-testcase:///issue54357.dart:27:13 -> MapConstant(const {4: 4, 3: 3}) +Evaluated: MapConcatenation @ org-dartlang-testcase:///issue54357.dart:28:7 -> MapConstant(const {3: 3, 4: 4}) +Evaluated: MapConcatenation @ org-dartlang-testcase:///issue54357.dart:29:7 -> MapConstant(const {4: 4, 3: 3}) +Evaluated: MapConcatenation @ org-dartlang-testcase:///issue54357.dart:30:7 -> MapConstant(const {3: 3, 4: 4}) +Extra constant evaluation: evaluated: 27, effectively constant: 23 diff --git a/pkg/front_end/testcases/extension_types/issue54357.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/issue54357.dart.weak.transformed.expect new file mode 100644 index 000000000000..6c9377e95aa7 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/issue54357.dart.weak.transformed.expect @@ -0,0 +1,55 @@ +library; +import self as self; +import "dart:core" as core; + +extension type ExInt(core::int _) implements core::int { + abstract extension-type-member representation-field get _() → core::int; + constructor • = self::ExInt|constructor#; + constructor tearoff • = self::ExInt|constructor#_#new#tearOff; +} +static const field self::ExInt /* = core::int */ ex3 = #C1; +static const field self::ExInt /* = core::int */ ex4 = #C2; +static const field core::List l3 = #C3; +static const field core::List l4 = #C4; +static const field core::List l34i = #C5; +static const field core::List l43 = #C6; +static const field core::List l3s4 = #C5; +static const field core::List ls43 = #C6; +static const field core::List ls3s4 = #C5; +static const field core::Set s3 = #C7; +static const field core::Set s4 = #C8; +static const field core::Set s34i = #C9; +static const field core::Set s43 = #C10; +static const field core::Set s3s4 = #C9; +static const field core::Set ss43 = #C10; +static const field core::Set ss3s4 = #C9; +static const field core::Map m3 = #C11; +static const field core::Map m4 = #C12; +static const field core::Map m34i = #C13; +static const field core::Map m43 = #C14; +static const field core::Map m3s4 = #C13; +static const field core::Map ms43 = #C14; +static const field core::Map ms3s4 = #C13; +static extension-type-member method ExInt|constructor#(core::int _) → self::ExInt /* = core::int */ { + lowered final self::ExInt /* = core::int */ #this = _; + return #this; +} +static extension-type-member method ExInt|constructor#_#new#tearOff(core::int _) → self::ExInt /* = core::int */ + return self::ExInt|constructor#(_); + +constants { + #C1 = 3 + #C2 = 4 + #C3 = [#C1] + #C4 = [#C2] + #C5 = [#C1, #C2] + #C6 = [#C2, #C1] + #C7 = {#C1} + #C8 = {#C2} + #C9 = {#C1, #C2} + #C10 = {#C2, #C1} + #C11 = {#C1:#C1} + #C12 = {#C2:#C2} + #C13 = {#C1:#C1, #C2:#C2} + #C14 = {#C2:#C2, #C1:#C1} +}