-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cfe] Add test for flutter issue 100888
Add test that show that the compile-time error is correctly emitted. This issue was fixed by https://dart-review.googlesource.com/c/sdk/+/236540 Change-Id: Ic56fcd584a32d38aa9f73a28ff5237341193b14f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253760 Reviewed-by: Jens Johansen <jensj@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
- Loading branch information
1 parent
35413ac
commit 5b489e6
Showing
8 changed files
with
187 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ adapter | |
adaptor | ||
adopted | ||
advantages | ||
af | ||
albeit | ||
aligns | ||
allocations | ||
|
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,22 @@ | ||
// Copyright (c) 2022, 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. | ||
|
||
abstract class ChannelA { | ||
ChannelB? get channel; | ||
} | ||
|
||
abstract class ChannelB { | ||
ActiveFrom? get activeFrom; | ||
} | ||
|
||
abstract class ActiveFrom { | ||
DateTime toLocal(); | ||
} | ||
|
||
void method(ChannelA channel) { | ||
DateTime? af = channel.channel?.activeFrom != null ? DateTime( | ||
channel.channel!.activeFrom!.toLocal().year, | ||
channel.channel!.activeFrom!.toLocal().month, | ||
channel.channel!.activeFrom!.toLocal().day); | ||
} |
13 changes: 13 additions & 0 deletions
13
pkg/front_end/testcases/general/flutter_issue100888.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,13 @@ | ||
abstract class ChannelA { | ||
ChannelB? get channel; | ||
} | ||
|
||
abstract class ChannelB { | ||
ActiveFrom? get activeFrom; | ||
} | ||
|
||
abstract class ActiveFrom { | ||
DateTime toLocal(); | ||
} | ||
|
||
void method(ChannelA channel) {} |
13 changes: 13 additions & 0 deletions
13
pkg/front_end/testcases/general/flutter_issue100888.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,13 @@ | ||
abstract class ActiveFrom { | ||
DateTime toLocal(); | ||
} | ||
|
||
abstract class ChannelA { | ||
ChannelB? get channel; | ||
} | ||
|
||
abstract class ChannelB { | ||
ActiveFrom? get activeFrom; | ||
} | ||
|
||
void method(ChannelA channel) {} |
39 changes: 39 additions & 0 deletions
39
pkg/front_end/testcases/general/flutter_issue100888.dart.weak.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,39 @@ | ||
library /*isNonNullableByDefault*/; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected ':' before this. | ||
// channel.channel!.activeFrom!.toLocal().day); | ||
// ^ | ||
// | ||
// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected an identifier, but got ';'. | ||
// Try inserting an identifier before ';'. | ||
// channel.channel!.activeFrom!.toLocal().day); | ||
// ^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class ChannelA extends core::Object { | ||
synthetic constructor •() → self::ChannelA | ||
: super core::Object::•() | ||
; | ||
abstract get channel() → self::ChannelB?; | ||
} | ||
abstract class ChannelB extends core::Object { | ||
synthetic constructor •() → self::ChannelB | ||
: super core::Object::•() | ||
; | ||
abstract get activeFrom() → self::ActiveFrom?; | ||
} | ||
abstract class ActiveFrom extends core::Object { | ||
synthetic constructor •() → self::ActiveFrom | ||
: super core::Object::•() | ||
; | ||
abstract method toLocal() → core::DateTime; | ||
} | ||
static method method(self::ChannelA channel) → void { | ||
core::DateTime? af = !((let final self::ChannelB? #t1 = channel.{self::ChannelA::channel}{self::ChannelB?} in #t1 == null ?{self::ActiveFrom?} null : #t1{self::ChannelB}.{self::ChannelB::activeFrom}{self::ActiveFrom?}) == null) ?{invalid-type} new core::DateTime::•(channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::year}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::month}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::day}{core::int}) : invalid-expression "pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: This couldn't be parsed. | ||
channel.channel!.activeFrom!.toLocal().day); | ||
^"; | ||
} |
39 changes: 39 additions & 0 deletions
39
pkg/front_end/testcases/general/flutter_issue100888.dart.weak.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,39 @@ | ||
library /*isNonNullableByDefault*/; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected ':' before this. | ||
// channel.channel!.activeFrom!.toLocal().day); | ||
// ^ | ||
// | ||
// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected an identifier, but got ';'. | ||
// Try inserting an identifier before ';'. | ||
// channel.channel!.activeFrom!.toLocal().day); | ||
// ^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class ChannelA extends core::Object { | ||
synthetic constructor •() → self::ChannelA | ||
: super core::Object::•() | ||
; | ||
abstract get channel() → self::ChannelB?; | ||
} | ||
abstract class ChannelB extends core::Object { | ||
synthetic constructor •() → self::ChannelB | ||
: super core::Object::•() | ||
; | ||
abstract get activeFrom() → self::ActiveFrom?; | ||
} | ||
abstract class ActiveFrom extends core::Object { | ||
synthetic constructor •() → self::ActiveFrom | ||
: super core::Object::•() | ||
; | ||
abstract method toLocal() → core::DateTime; | ||
} | ||
static method method(self::ChannelA channel) → void { | ||
core::DateTime? af = !((let final self::ChannelB? #t1 = channel.{self::ChannelA::channel}{self::ChannelB?} in #t1 == null ?{self::ActiveFrom?} null : #t1{self::ChannelB}.{self::ChannelB::activeFrom}{self::ActiveFrom?}) == null) ?{invalid-type} new core::DateTime::•(channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::year}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::month}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::day}{core::int}) : invalid-expression "pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: This couldn't be parsed. | ||
channel.channel!.activeFrom!.toLocal().day); | ||
^"; | ||
} |
21 changes: 21 additions & 0 deletions
21
pkg/front_end/testcases/general/flutter_issue100888.dart.weak.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,21 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class ChannelA extends core::Object { | ||
synthetic constructor •() → self::ChannelA | ||
; | ||
abstract get channel() → self::ChannelB?; | ||
} | ||
abstract class ChannelB extends core::Object { | ||
synthetic constructor •() → self::ChannelB | ||
; | ||
abstract get activeFrom() → self::ActiveFrom?; | ||
} | ||
abstract class ActiveFrom extends core::Object { | ||
synthetic constructor •() → self::ActiveFrom | ||
; | ||
abstract method toLocal() → core::DateTime; | ||
} | ||
static method method(self::ChannelA channel) → void | ||
; |
39 changes: 39 additions & 0 deletions
39
pkg/front_end/testcases/general/flutter_issue100888.dart.weak.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,39 @@ | ||
library /*isNonNullableByDefault*/; | ||
// | ||
// Problems in library: | ||
// | ||
// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected ':' before this. | ||
// channel.channel!.activeFrom!.toLocal().day); | ||
// ^ | ||
// | ||
// pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: Expected an identifier, but got ';'. | ||
// Try inserting an identifier before ';'. | ||
// channel.channel!.activeFrom!.toLocal().day); | ||
// ^ | ||
// | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class ChannelA extends core::Object { | ||
synthetic constructor •() → self::ChannelA | ||
: super core::Object::•() | ||
; | ||
abstract get channel() → self::ChannelB?; | ||
} | ||
abstract class ChannelB extends core::Object { | ||
synthetic constructor •() → self::ChannelB | ||
: super core::Object::•() | ||
; | ||
abstract get activeFrom() → self::ActiveFrom?; | ||
} | ||
abstract class ActiveFrom extends core::Object { | ||
synthetic constructor •() → self::ActiveFrom | ||
: super core::Object::•() | ||
; | ||
abstract method toLocal() → core::DateTime; | ||
} | ||
static method method(self::ChannelA channel) → void { | ||
core::DateTime? af = !((let final self::ChannelB? #t1 = channel.{self::ChannelA::channel}{self::ChannelB?} in #t1 == null ?{self::ActiveFrom?} null : #t1{self::ChannelB}.{self::ChannelB::activeFrom}{self::ActiveFrom?}) == null) ?{invalid-type} new core::DateTime::•(channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::year}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::month}{core::int}, channel.{self::ChannelA::channel}{self::ChannelB?}!.{self::ChannelB::activeFrom}{self::ActiveFrom?}!.{self::ActiveFrom::toLocal}(){() → core::DateTime}.{core::DateTime::day}{core::int}) : invalid-expression "pkg/front_end/testcases/general/flutter_issue100888.dart:21:50: Error: This couldn't be parsed. | ||
channel.channel!.activeFrom!.toLocal().day); | ||
^"; | ||
} |