-
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.
Merge 36be5e7 into dev
- Loading branch information
Showing
20 changed files
with
530 additions
and
15 deletions.
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
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
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
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
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
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
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
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
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,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
78
pkg/front_end/testcases/patterns/issue55310.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,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); | ||
} |
78 changes: 78 additions & 0 deletions
78
pkg/front_end/testcases/patterns/issue55310.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,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); | ||
} |
23 changes: 23 additions & 0 deletions
23
pkg/front_end/testcases/patterns/issue55310.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,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) {} |
23 changes: 23 additions & 0 deletions
23
pkg/front_end/testcases/patterns/issue55310.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,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() {} |
Oops, something went wrong.