Skip to content

Commit

Permalink
Version 3.5.0-40.0.dev
Browse files Browse the repository at this point in the history
Merge 36be5e7 into dev
  • Loading branch information
Dart CI committed Apr 9, 2024
2 parents 8266cd6 + 36be5e7 commit acdfd82
Show file tree
Hide file tree
Showing 20 changed files with 530 additions and 15 deletions.
6 changes: 4 additions & 2 deletions benchmarks/TearOff/dart/TearOff.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ class BenchTearOffInlinedInTry extends BenchmarkBase {
callIt(foo, 10);
} finally {
const int expectedSum = 20 * (20 - 1) ~/ 2;
if (sum != expectedSum) throw 'Bad result: $sum';
sum -= expectedSum;
}
if (sum != 0) throw 'Bad result: $sum';
}
}

Expand Down Expand Up @@ -182,8 +183,9 @@ class BenchTearOffNotInlinedInTry extends BenchmarkBase {
callIt(foo, 10);
} finally {
const int expectedSum = 20 * (20 - 1) ~/ 2;
if (sum != expectedSum) throw 'Bad result: $sum';
sum -= expectedSum;
}
if (sum != 0) throw 'Bad result: $sum';
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/_fe_analyzer_shared/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Logic that is shared between the front_end and analyzer packages.
repository: https://github.com/dart-lang/sdk/tree/main/pkg/_fe_analyzer_shared

environment:
sdk: ^3.2.0
sdk: ^3.3.0

dependencies:
meta: ^1.9.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ class PromotedCacheableExpression
final AccessKey accessKey;

PromotedCacheableExpression(this._expression, this._promotedType)
: accessKey = new PromotedAccessKey(_expression.cacheKey, _promotedType);
: accessKey = new PromotedAccessKey(_expression.accessKey, _promotedType);

@override
CacheKey get cacheKey => _expression.cacheKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ static method foo(core::Object o, core::num value) → void {
#L1:
{
final synthesized core::Object #0#0 = o;
synthesized (core::int) → void #0#2;
synthesized dynamic #0#2;
synthesized core::bool #0#2#isSet = false;
{
hoisted (core::num) → void f;
if(#0#0 is self::B && (let final dynamic #t3 = #0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final dynamic #t4 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void} in true) && (let final dynamic #t5 = f = (#0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final dynamic #t6 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void}) as{CovarianceCheck} (core::num) → void in true)) {
if(#0#0 is self::B && (let final dynamic #t3 = #0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final dynamic #t4 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void} in true) && (let final dynamic #t5 = f = (#0#2#isSet ?{(core::num) → void} #0#2{(core::num) → void} : let final dynamic #t6 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::A::g}{(core::num) → void}) as{CovarianceCheck} (core::num) → void in true)) {
{
f(value){(core::num) → void};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ static method foo(core::Object o, core::num value) → void {
#L1:
{
final synthesized core::Object #0#0 = o;
synthesized (core::int) → void #0#2;
synthesized dynamic #0#2;
synthesized core::bool #0#2#isSet = false;
{
hoisted (core::num) → void f;
if(#0#0 is self::B && (let final (core::int) → void #t3 = #0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final core::bool* #t4 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void} in true) && (let final (core::num) → void #t5 = f = (#0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final core::bool* #t6 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void}) as{CovarianceCheck} (core::num) → void in true)) {
if(#0#0 is self::B && (let final (core::int) → void #t3 = #0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final core::bool* #t4 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void} in true) && (let final (core::num) → void #t5 = f = (#0#2#isSet ?{(core::num) → void} #0#2{(core::num) → void} : let final core::bool* #t6 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::A::g}{(core::num) → void}) as{CovarianceCheck} (core::num) → void in true)) {
{
f(value){(core::num) → void};
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/front_end/testcases/patterns/issue52192.dart.weak.expect
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ static method foo(core::Object o, core::num value) → void {
#L1:
{
final synthesized core::Object #0#0 = o;
synthesized (core::int) → void #0#2;
synthesized dynamic #0#2;
synthesized core::bool #0#2#isSet = false;
{
hoisted (core::num) → void f;
if(#0#0 is self::B && (let final dynamic #t3 = #0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final dynamic #t4 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void} in true) && (let final dynamic #t5 = f = (#0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final dynamic #t6 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void}) as{CovarianceCheck} (core::num) → void in true)) {
if(#0#0 is self::B && (let final dynamic #t3 = #0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final dynamic #t4 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void} in true) && (let final dynamic #t5 = f = (#0#2#isSet ?{(core::num) → void} #0#2{(core::num) → void} : let final dynamic #t6 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::A::g}{(core::num) → void}) as{CovarianceCheck} (core::num) → void in true)) {
{
f(value){(core::num) → void};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ static method foo(core::Object o, core::num value) → void {
#L1:
{
final synthesized core::Object #0#0 = o;
synthesized (core::int) → void #0#2;
synthesized dynamic #0#2;
synthesized core::bool #0#2#isSet = false;
{
hoisted (core::num) → void f;
if(#0#0 is self::B && (let final dynamic #t3 = #0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final dynamic #t4 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void} in true) && (let final dynamic #t5 = f = (#0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final dynamic #t6 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void}) as{CovarianceCheck} (core::num) → void in true)) {
if(#0#0 is self::B && (let final dynamic #t3 = #0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final dynamic #t4 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void} in true) && (let final dynamic #t5 = f = (#0#2#isSet ?{(core::num) → void} #0#2{(core::num) → void} : let final dynamic #t6 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::A::g}{(core::num) → void}) as{CovarianceCheck} (core::num) → void in true)) {
{
f(value){(core::num) → void};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ static method foo(core::Object o, core::num value) → void {
#L1:
{
final synthesized core::Object #0#0 = o;
synthesized (core::int) → void #0#2;
synthesized dynamic #0#2;
synthesized core::bool #0#2#isSet = false;
{
hoisted (core::num) → void f;
if(#0#0 is self::B && (let final (core::int) → void #t3 = #0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final core::bool* #t4 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void} in true) && (let final (core::num) → void #t5 = f = (#0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final core::bool* #t6 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void}) as{CovarianceCheck} (core::num) → void in true)) {
if(#0#0 is self::B && (let final (core::int) → void #t3 = #0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final core::bool* #t4 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void} in true) && (let final (core::num) → void #t5 = f = (#0#2#isSet ?{(core::num) → void} #0#2{(core::num) → void} : let final core::bool* #t6 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::A::g}{(core::num) → void}) as{CovarianceCheck} (core::num) → void in true)) {
{
f(value){(core::num) → void};
}
Expand Down
36 changes: 36 additions & 0 deletions pkg/front_end/testcases/patterns/issue55310.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// 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.

class Other {
String text = 42.toString();
}

class Inner {
Other? other = int.parse('3') == 3 ? Other() : null;
}

sealed class Wrapper {}

class WrapperA extends Wrapper {
Inner inner = Inner();
}

class WrapperB extends Wrapper {
Inner inner = Inner();
}

var obj = int.parse('1') == 1 ? WrapperB() : WrapperA();

void main() {
foo(obj);
}

void foo(Wrapper wrapper) {
print(switch (wrapper) {
WrapperA(inner: Inner(other: final Other other)) => other.text,
WrapperA(inner: Inner(other: null)) => "no other",
WrapperB(inner: Inner(other: final Other other)) => other.text,
WrapperB(inner: Inner(other: null)) => "no other",
});
}
78 changes: 78 additions & 0 deletions pkg/front_end/testcases/patterns/issue55310.dart.strong.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
library;
import self as self;
import "dart:core" as core;

class Other extends core::Object {
field core::String text = 42.{core::int::toString}(){() → core::String};
synthetic constructor •() → self::Other
: super core::Object::•()
;
}
class Inner extends core::Object {
field self::Other? other = core::int::parse("3") =={core::num::==}{(core::Object) → core::bool} 3 ?{self::Other?} new self::Other::•() : null;
synthetic constructor •() → self::Inner
: super core::Object::•()
;
}
abstract sealed class Wrapper extends core::Object {
synthetic constructor •() → self::Wrapper
: super core::Object::•()
;
}
class WrapperA extends self::Wrapper {
field self::Inner inner = new self::Inner::•();
synthetic constructor •() → self::WrapperA
: super self::Wrapper::•()
;
}
class WrapperB extends self::Wrapper {
field self::Inner inner = new self::Inner::•();
synthetic constructor •() → self::WrapperB
: super self::Wrapper::•()
;
}
static field self::Wrapper obj = core::int::parse("1") =={core::num::==}{(core::Object) → core::bool} 1 ?{self::Wrapper} new self::WrapperB::•() : new self::WrapperA::•();
static method main() → void {
self::foo(self::obj);
}
static method foo(self::Wrapper wrapper) → void {
core::print( block {
core::String #t1;
final synthesized self::Wrapper #0#0 = wrapper;
synthesized self::Other? #0#3;
synthesized core::bool #0#3#isSet = false;
synthesized core::bool #0#5;
synthesized core::bool #0#5#isSet = false;
#L1:
{
{
final hoisted self::Other other;
if(#0#0 is self::WrapperA && (#0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final dynamic #t2 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperA}.{self::WrapperA::inner}{self::Inner}.{self::Inner::other}{self::Other?}) is self::Other) {
other = (#0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final dynamic #t3 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperA}.{self::WrapperA::inner}{self::Inner}.{self::Inner::other}{self::Other?}) as{Unchecked} self::Other;
#t1 = other.{self::Other::text}{core::String};
break #L1;
}
}
{
if(#0#0 is self::WrapperA && (#0#5#isSet ?{core::bool} #0#5{core::bool} : let final dynamic #t4 = #0#5#isSet = true in #0#5 = (#0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final dynamic #t5 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperA}.{self::WrapperA::inner}{self::Inner}.{self::Inner::other}{self::Other?}) == null)) {
#t1 = "no other";
break #L1;
}
}
{
final hoisted self::Other other;
if(#0#0 is self::WrapperB && (#0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final dynamic #t6 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperB}.{self::WrapperB::inner}{self::Inner}.{self::Inner::other}{self::Other?}) is self::Other) {
other = (#0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final dynamic #t7 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperB}.{self::WrapperB::inner}{self::Inner}.{self::Inner::other}{self::Other?}) as{Unchecked} self::Other;
#t1 = other.{self::Other::text}{core::String};
break #L1;
}
}
{
if(#0#0 is self::WrapperB && (#0#5#isSet ?{core::bool} #0#5{core::bool} : let final dynamic #t8 = #0#5#isSet = true in #0#5 = (#0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final dynamic #t9 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperB}.{self::WrapperB::inner}{self::Inner}.{self::Inner::other}{self::Other?}) == null)) {
#t1 = "no other";
break #L1;
}
}
}
} =>#t1);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
library;
import self as self;
import "dart:core" as core;

class Other extends core::Object {
field core::String text = 42.{core::int::toString}(){() → core::String};
synthetic constructor •() → self::Other
: super core::Object::•()
;
}
class Inner extends core::Object {
field self::Other? other = core::int::parse("3") =={core::num::==}{(core::Object) → core::bool} 3 ?{self::Other?} new self::Other::•() : null;
synthetic constructor •() → self::Inner
: super core::Object::•()
;
}
abstract sealed class Wrapper extends core::Object {
synthetic constructor •() → self::Wrapper
: super core::Object::•()
;
}
class WrapperA extends self::Wrapper {
field self::Inner inner = new self::Inner::•();
synthetic constructor •() → self::WrapperA
: super self::Wrapper::•()
;
}
class WrapperB extends self::Wrapper {
field self::Inner inner = new self::Inner::•();
synthetic constructor •() → self::WrapperB
: super self::Wrapper::•()
;
}
static field self::Wrapper obj = core::int::parse("1") =={core::num::==}{(core::Object) → core::bool} 1 ?{self::Wrapper} new self::WrapperB::•() : new self::WrapperA::•();
static method main() → void {
self::foo(self::obj);
}
static method foo(self::Wrapper wrapper) → void {
core::print( block {
core::String #t1;
final synthesized self::Wrapper #0#0 = wrapper;
synthesized self::Other? #0#3;
synthesized core::bool #0#3#isSet = false;
synthesized core::bool #0#5;
synthesized core::bool #0#5#isSet = false;
#L1:
{
{
final hoisted self::Other other;
if(#0#0 is self::WrapperA && (#0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final core::bool* #t2 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperA}.{self::WrapperA::inner}{self::Inner}.{self::Inner::other}{self::Other?}) is self::Other) {
other = let self::Other? #t3 = #0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final core::bool* #t4 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperA}.{self::WrapperA::inner}{self::Inner}.{self::Inner::other}{self::Other?} in #t3 == null ?{self::Other} #t3 as{Unchecked} self::Other : #t3{self::Other};
#t1 = other.{self::Other::text}{core::String};
break #L1;
}
}
{
if(#0#0 is self::WrapperA && (#0#5#isSet ?{core::bool} #0#5{core::bool} : let final core::bool* #t5 = #0#5#isSet = true in #0#5 = (#0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final core::bool* #t6 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperA}.{self::WrapperA::inner}{self::Inner}.{self::Inner::other}{self::Other?}) == null)) {
#t1 = "no other";
break #L1;
}
}
{
final hoisted self::Other other;
if(#0#0 is self::WrapperB && (#0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final core::bool* #t7 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperB}.{self::WrapperB::inner}{self::Inner}.{self::Inner::other}{self::Other?}) is self::Other) {
other = let self::Other? #t8 = #0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final core::bool* #t9 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperB}.{self::WrapperB::inner}{self::Inner}.{self::Inner::other}{self::Other?} in #t8 == null ?{self::Other} #t8 as{Unchecked} self::Other : #t8{self::Other};
#t1 = other.{self::Other::text}{core::String};
break #L1;
}
}
{
if(#0#0 is self::WrapperB && (#0#5#isSet ?{core::bool} #0#5{core::bool} : let final core::bool* #t10 = #0#5#isSet = true in #0#5 = (#0#3#isSet ?{self::Other?} #0#3{self::Other?} : let final core::bool* #t11 = #0#3#isSet = true in #0#3 = #0#0{self::WrapperB}.{self::WrapperB::inner}{self::Inner}.{self::Inner::other}{self::Other?}) == null)) {
#t1 = "no other";
break #L1;
}
}
}
} =>#t1);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Other {
String text = 42.toString();
}

class Inner {
Other? other = int.parse('3') == 3 ? Other() : null;
}

sealed class Wrapper {}

class WrapperA extends Wrapper {
Inner inner = Inner();
}

class WrapperB extends Wrapper {
Inner inner = Inner();
}

var obj = int.parse('1') == 1 ? WrapperB() : WrapperA();

void main() {}

void foo(Wrapper wrapper) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Inner {
Other? other = int.parse('3') == 3 ? Other() : null;
}

class Other {
String text = 42.toString();
}

class WrapperA extends Wrapper {
Inner inner = Inner();
}

class WrapperB extends Wrapper {
Inner inner = Inner();
}

sealed class Wrapper {}

var obj = int.parse('1') == 1 ? WrapperB() : WrapperA();

void foo(Wrapper wrapper) {}

void main() {}
Loading

0 comments on commit acdfd82

Please sign in to comment.