Version 2.10.0-83.0.dev
Merge commit '8805a3f9c727603573a5ff57bd39a76d7a87f2ae' into 'dev'
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 01fc714..2c22a93 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -884,7 +884,7 @@
if (previousSource == null || previousSource.isEmpty) {
return null;
}
- String before = textualOutline(previousSource);
+ String before = textualOutline(previousSource, performModelling: true);
if (before == null) {
return null;
}
@@ -892,7 +892,8 @@
FileSystemEntity entity =
c.options.fileSystem.entityForUri(builder.fileUri);
if (await entity.exists()) {
- now = textualOutline(await entity.readAsBytes());
+ now =
+ textualOutline(await entity.readAsBytes(), performModelling: true);
}
if (before != now) {
return null;
diff --git a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
index c1cbe7d..7418ddc 100644
--- a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
@@ -591,11 +591,24 @@
});
constructors.local.forEach((String name, MemberBuilder builder) {
- if (builder is ConstructorBuilder &&
- !builder.isExternal &&
- builder.formals != null) {
- libraryBuilder.checkInitializersInFormals(
- builder.formals, typeEnvironment);
+ if (builder is ConstructorBuilder) {
+ if (!builder.isExternal && builder.formals != null) {
+ libraryBuilder.checkInitializersInFormals(
+ builder.formals, typeEnvironment);
+ }
+ } else if (builder is RedirectingFactoryBuilder) {
+ // Default values are not required on redirecting factory constructors.
+ } else if (builder is ProcedureBuilder) {
+ assert(builder.isFactory, "Unexpected constructor $builder.");
+ if (!builder.isExternal && builder.formals != null) {
+ libraryBuilder.checkInitializersInFormals(
+ builder.formals, typeEnvironment);
+ }
+ } else {
+ assert(
+ // This is a synthesized constructor.
+ builder is DillMemberBuilder && builder.member is Constructor,
+ "Unexpected constructor $builder.");
}
});
}
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index 1c18fee..769bf24 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -89,6 +89,7 @@
cb
cc
ccc
+cell
charcode
charset
checkme
@@ -136,6 +137,7 @@
conversion
conversions
coo
+corners
costly
cov
cp
@@ -465,6 +467,7 @@
overlay
pack
paging
+paint
party
pause
paused
@@ -543,6 +546,7 @@
rev
risky
row
+rows
runtimes
say
scans
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml
index 07a3cda..a583a95 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml
@@ -42,7 +42,7 @@
}
class Boz extends Widget {
- factory Boz({bool createNew}) {
+ factory Boz({required bool createNew}) {
if (createNew) {
return new Boz._();
} else {
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.1.expect
index 3847ff7..b4fad46 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.1.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.1.expect
@@ -66,7 +66,7 @@
const constructor _({wid::_Location? $creationLocationd_0dea112b090073317d4}) → foo::Boz
: super fra::Widget::•($creationLocationd_0dea112b090073317d4: $creationLocationd_0dea112b090073317d4)
;
- static factory •({dart.core::bool createNew = #C1, wid::_Location? $creationLocationd_0dea112b090073317d4}) → foo::Boz {
+ static factory •({required dart.core::bool createNew = #C1, wid::_Location? $creationLocationd_0dea112b090073317d4}) → foo::Boz {
if(createNew) {
return new foo::Boz::_($creationLocationd_0dea112b090073317d4: $creationLocationd_0dea112b090073317d4);
}
@@ -99,7 +99,7 @@
#C9 = wid::_Location {file:#C2, line:#C8, column:#C4, name:#C1, parameterLocations:#C5}
#C10 = foo::Baz {_location:#C9}
#C11 = 9.0
- #C12 = 119.0
+ #C12 = 128.0
#C13 = wid::_Location {file:#C2, line:#C11, column:#C12, name:#C1, parameterLocations:#C5}
#C14 = foo::Boz {_location:#C13}
#C15 = "org-dartlang-test:///main.dart"
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.2.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.2.expect
index e48708e..b6f2a14 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.2.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.2.expect
@@ -66,7 +66,7 @@
const constructor _({wid::_Location? $creationLocationd_0dea112b090073317d4}) → foo::Boz
: super fra::Widget::•($creationLocationd_0dea112b090073317d4: $creationLocationd_0dea112b090073317d4)
;
- static factory •({dart.core::bool createNew = #C1, wid::_Location? $creationLocationd_0dea112b090073317d4}) → foo::Boz {
+ static factory •({required dart.core::bool createNew = #C1, wid::_Location? $creationLocationd_0dea112b090073317d4}) → foo::Boz {
if(createNew) {
return new foo::Boz::_($creationLocationd_0dea112b090073317d4: $creationLocationd_0dea112b090073317d4);
}
@@ -93,7 +93,7 @@
#C9 = wid::_Location {file:#C2, line:#C8, column:#C4, name:#C1, parameterLocations:#C5}
#C10 = foo::Baz {_location:#C9}
#C11 = 9.0
- #C12 = 119.0
+ #C12 = 128.0
#C13 = wid::_Location {file:#C2, line:#C11, column:#C12, name:#C1, parameterLocations:#C5}
#C14 = foo::Boz {_location:#C13}
}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.3.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.3.expect
index 3847ff7..b4fad46 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.3.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/flutter_widget_transform_const.yaml.world.3.expect
@@ -66,7 +66,7 @@
const constructor _({wid::_Location? $creationLocationd_0dea112b090073317d4}) → foo::Boz
: super fra::Widget::•($creationLocationd_0dea112b090073317d4: $creationLocationd_0dea112b090073317d4)
;
- static factory •({dart.core::bool createNew = #C1, wid::_Location? $creationLocationd_0dea112b090073317d4}) → foo::Boz {
+ static factory •({required dart.core::bool createNew = #C1, wid::_Location? $creationLocationd_0dea112b090073317d4}) → foo::Boz {
if(createNew) {
return new foo::Boz::_($creationLocationd_0dea112b090073317d4: $creationLocationd_0dea112b090073317d4);
}
@@ -99,7 +99,7 @@
#C9 = wid::_Location {file:#C2, line:#C8, column:#C4, name:#C1, parameterLocations:#C5}
#C10 = foo::Baz {_location:#C9}
#C11 = 9.0
- #C12 = 119.0
+ #C12 = 128.0
#C13 = wid::_Location {file:#C2, line:#C11, column:#C12, name:#C1, parameterLocations:#C5}
#C14 = foo::Boz {_location:#C13}
#C15 = "org-dartlang-test:///main.dart"
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml
new file mode 100644
index 0000000..0a99343
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml
@@ -0,0 +1,86 @@
+# Copyright (c) 2020, 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.md file.
+
+# Re-ordering things is OK.
+
+type: newworld
+worlds:
+ - entry: main.dart
+ experiments: alternative-invalidation-strategy
+ sources:
+ main.dart: |
+ import 'lib.dart';
+ class A {
+ int a() {
+ return 42;
+ }
+ int b() {
+ return 2;
+ }
+ }
+ lib.dart: |
+ class B {
+ int a() {
+ return 42;
+ }
+ int b() {
+ return 2;
+ }
+ }
+ class C {
+ int a() {
+ return 42;
+ }
+ int b() {
+ return 2;
+ }
+ }
+ expectedLibraryCount: 2
+
+ - entry: main.dart
+ experiments: alternative-invalidation-strategy
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - main.dart
+ sources:
+ main.dart: |
+ import 'lib.dart';
+ class A {
+ int b() {
+ return 42;
+ }
+ int a() {
+ return 2;
+ }
+ }
+ expectedLibraryCount: 2
+ expectsRebuildBodiesOnly: true
+
+ - entry: main.dart
+ experiments: alternative-invalidation-strategy
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - lib.dart
+ sources:
+ lib.dart: |
+ class C {
+ int b() {
+ return 1;
+ }
+ int a() {
+ return 2;
+ }
+ }
+ class B {
+ int b() {
+ return 3;
+ }
+ int a() {
+ return 4;
+ }
+ }
+ expectedLibraryCount: 2
+ expectsRebuildBodiesOnly: true
\ No newline at end of file
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml.world.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml.world.1.expect
new file mode 100644
index 0000000..1a0bc10
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml.world.1.expect
@@ -0,0 +1,72 @@
+main = <No Member>;
+library from "org-dartlang-test:///lib.dart" as lib {
+
+ class B extends dart.core::Object {
+ synthetic constructor •() → lib::B*
+ : super dart.core::Object::•()
+ ;
+ method a() → dart.core::int* {
+ return 42;
+ }
+ method b() → dart.core::int* {
+ return 2;
+ }
+ abstract member-signature get _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
+ abstract member-signature get hashCode() → dart.core::int*; -> dart.core::Object::hashCode
+ abstract member-signature method toString() → dart.core::String*; -> dart.core::Object::toString
+ abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
+ }
+ class C extends dart.core::Object {
+ synthetic constructor •() → lib::C*
+ : super dart.core::Object::•()
+ ;
+ method a() → dart.core::int* {
+ return 42;
+ }
+ method b() → dart.core::int* {
+ return 2;
+ }
+ abstract member-signature get _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
+ abstract member-signature get hashCode() → dart.core::int*; -> dart.core::Object::hashCode
+ abstract member-signature method toString() → dart.core::String*; -> dart.core::Object::toString
+ abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///lib.dart";
+
+ class A extends dart.core::Object {
+ synthetic constructor •() → main::A*
+ : super dart.core::Object::•()
+ ;
+ method a() → dart.core::int* {
+ return 42;
+ }
+ method b() → dart.core::int* {
+ return 2;
+ }
+ abstract member-signature get _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
+ abstract member-signature get hashCode() → dart.core::int*; -> dart.core::Object::hashCode
+ abstract member-signature method toString() → dart.core::String*; -> dart.core::Object::toString
+ abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml.world.2.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml.world.2.expect
new file mode 100644
index 0000000..89512bc
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml.world.2.expect
@@ -0,0 +1,72 @@
+main = <No Member>;
+library from "org-dartlang-test:///lib.dart" as lib {
+
+ class B extends dart.core::Object {
+ synthetic constructor •() → lib::B*
+ : super dart.core::Object::•()
+ ;
+ method a() → dart.core::int* {
+ return 42;
+ }
+ method b() → dart.core::int* {
+ return 2;
+ }
+ abstract member-signature get _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
+ abstract member-signature get hashCode() → dart.core::int*; -> dart.core::Object::hashCode
+ abstract member-signature method toString() → dart.core::String*; -> dart.core::Object::toString
+ abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
+ }
+ class C extends dart.core::Object {
+ synthetic constructor •() → lib::C*
+ : super dart.core::Object::•()
+ ;
+ method a() → dart.core::int* {
+ return 42;
+ }
+ method b() → dart.core::int* {
+ return 2;
+ }
+ abstract member-signature get _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
+ abstract member-signature get hashCode() → dart.core::int*; -> dart.core::Object::hashCode
+ abstract member-signature method toString() → dart.core::String*; -> dart.core::Object::toString
+ abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///lib.dart";
+
+ class A extends dart.core::Object {
+ synthetic constructor •() → main::A*
+ : super dart.core::Object::•()
+ ;
+ method b() → dart.core::int* {
+ return 42;
+ }
+ method a() → dart.core::int* {
+ return 2;
+ }
+ abstract member-signature get _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
+ abstract member-signature get hashCode() → dart.core::int*; -> dart.core::Object::hashCode
+ abstract member-signature method toString() → dart.core::String*; -> dart.core::Object::toString
+ abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml.world.3.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml.world.3.expect
new file mode 100644
index 0000000..fb95995
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_39.yaml.world.3.expect
@@ -0,0 +1,72 @@
+main = <No Member>;
+library from "org-dartlang-test:///lib.dart" as lib {
+
+ class C extends dart.core::Object {
+ synthetic constructor •() → lib::C*
+ : super dart.core::Object::•()
+ ;
+ method b() → dart.core::int* {
+ return 1;
+ }
+ method a() → dart.core::int* {
+ return 2;
+ }
+ abstract member-signature get _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
+ abstract member-signature get hashCode() → dart.core::int*; -> dart.core::Object::hashCode
+ abstract member-signature method toString() → dart.core::String*; -> dart.core::Object::toString
+ abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
+ }
+ class B extends dart.core::Object {
+ synthetic constructor •() → lib::B*
+ : super dart.core::Object::•()
+ ;
+ method b() → dart.core::int* {
+ return 3;
+ }
+ method a() → dart.core::int* {
+ return 4;
+ }
+ abstract member-signature get _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
+ abstract member-signature get hashCode() → dart.core::int*; -> dart.core::Object::hashCode
+ abstract member-signature method toString() → dart.core::String*; -> dart.core::Object::toString
+ abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///lib.dart";
+
+ class A extends dart.core::Object {
+ synthetic constructor •() → main::A*
+ : super dart.core::Object::•()
+ ;
+ method b() → dart.core::int* {
+ return 42;
+ }
+ method a() → dart.core::int* {
+ return 2;
+ }
+ abstract member-signature get _identityHashCode() → dart.core::int*; -> dart.core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*; -> dart.core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*; -> dart.core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → dart.core::bool*; -> dart.core::Object::==
+ abstract member-signature get hashCode() → dart.core::int*; -> dart.core::Object::hashCode
+ abstract member-signature method toString() → dart.core::String*; -> dart.core::Object::toString
+ abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic; -> dart.core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → dart.core::Type*; -> dart.core::Object::runtimeType
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/status.status b/pkg/front_end/testcases/incremental_initialize_from_dill/status.status
index 3cae5cc..b3f0c48 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/status.status
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/status.status
@@ -3,3 +3,6 @@
# BSD-style license that can be found in the LICENSE.md file.
# Status file for the test suite ../test/incremental_load_from_dill_test.dart.
+
+# http://dartbug.com/41812#issuecomment-684825703
+strongmode_mixins_2: Crash
diff --git a/pkg/front_end/testcases/nnbd/issue42362.dart b/pkg/front_end/testcases/nnbd/issue42362.dart
index fe7cc97..e2150f9 100644
--- a/pkg/front_end/testcases/nnbd/issue42362.dart
+++ b/pkg/front_end/testcases/nnbd/issue42362.dart
@@ -38,6 +38,10 @@
factory A.factory7({required int i}) = A.constructor7; // ok
+ factory A.factory8([int i]) => new A.constructor3(); // error
+
+ factory A.factory9({int i}) => new A.constructor4(); // error
+
method3([int i]) {} // error
method4({int i}) {} // error
@@ -95,6 +99,10 @@
factory C.factory7({required int i}) = C.constructor7; // ok
+ factory C.factory8([int i]) => new C.constructor3(); // error
+
+ factory C.factory9({int i}) => new C.constructor4(); // error
+
method3([i]) {} // error
method4({i}) {} // error
diff --git a/pkg/front_end/testcases/nnbd/issue42362.dart.outline.expect b/pkg/front_end/testcases/nnbd/issue42362.dart.outline.expect
index 2911d31..8b438e7 100644
--- a/pkg/front_end/testcases/nnbd/issue42362.dart.outline.expect
+++ b/pkg/front_end/testcases/nnbd/issue42362.dart.outline.expect
@@ -2,11 +2,11 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:41:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:45:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method3([int i]) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:43:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:47:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method4({int i}) {} // error
// ^
//
@@ -26,30 +26,46 @@
// A.constructor4({int i}) // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:98:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:41:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory A.factory8([int i]) => new A.constructor3(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:43:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory A.factory9({int i}) => new A.constructor4(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:106:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method3([i]) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:100:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:108:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method4({i}) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:73:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:77:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor1([this.i]); // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:75:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:79:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor2({this.i}); // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:77:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:81:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor3([int i]) : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:79:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:83:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor4({int i}) : this.i = i; // error
// ^
//
+// pkg/front_end/testcases/nnbd/issue42362.dart:102:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.factory8([int i]) => new C.constructor3(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:104:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.factory9({int i}) => new C.constructor4(); // error
+// ^
+//
import self as self;
import "dart:core" as core;
@@ -84,6 +100,10 @@
let dynamic #redirecting_factory = self::A::constructor6 in invalid-expression;
static factory factory7({required core::int i}) → self::A
let dynamic #redirecting_factory = self::A::constructor7 in invalid-expression;
+ static factory factory8([core::int i]) → self::A
+ ;
+ static factory factory9({core::int i}) → self::A
+ ;
method method3([core::int i]) → dynamic
;
method method4({core::int i}) → dynamic
@@ -134,6 +154,10 @@
let dynamic #redirecting_factory = self::C::constructor6 in invalid-expression;
static factory factory7({required core::int i}) → self::C
let dynamic #redirecting_factory = self::C::constructor7 in invalid-expression;
+ static factory factory8([core::int i]) → self::C
+ ;
+ static factory factory9({core::int i}) → self::C
+ ;
method method3([core::int i]) → dynamic
;
method method4({core::int i}) → dynamic
diff --git a/pkg/front_end/testcases/nnbd/issue42362.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue42362.dart.strong.expect
index 7579211..212d75b 100644
--- a/pkg/front_end/testcases/nnbd/issue42362.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/issue42362.dart.strong.expect
@@ -2,11 +2,11 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:41:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:45:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method3([int i]) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:43:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:47:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method4({int i}) {} // error
// ^
//
@@ -26,30 +26,46 @@
// A.constructor4({int i}) // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:98:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:41:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory A.factory8([int i]) => new A.constructor3(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:43:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory A.factory9({int i}) => new A.constructor4(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:106:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method3([i]) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:100:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:108:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method4({i}) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:73:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:77:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor1([this.i]); // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:75:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:79:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor2({this.i}); // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:77:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:81:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor3([int i]) : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:79:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:83:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor4({int i}) : this.i = i; // error
// ^
//
+// pkg/front_end/testcases/nnbd/issue42362.dart:102:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.factory8([int i]) => new C.constructor3(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:104:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.factory9({int i}) => new C.constructor4(); // error
+// ^
+//
// pkg/front_end/testcases/nnbd/issue42362.dart:19:18: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// : this.i = i; // error
// ^
@@ -58,11 +74,11 @@
// : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:81:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/nnbd/issue42362.dart:85:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// C.constructor5([int? i]) : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:83:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/nnbd/issue42362.dart:87:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// C.constructor6({int? i}) : this.i = i; // error
// ^
//
@@ -113,6 +129,10 @@
let dynamic #redirecting_factory = self::A::constructor6 in invalid-expression;
static factory factory7({required core::int i = #C1}) → self::A
let dynamic #redirecting_factory = self::A::constructor7 in invalid-expression;
+ static factory factory8([core::int i = #C1]) → self::A
+ return new self::A::constructor3();
+ static factory factory9({core::int i = #C1}) → self::A
+ return new self::A::constructor4();
method method3([core::int i = #C1]) → dynamic {}
method method4({core::int i = #C1}) → dynamic {}
method method5([core::int? i = #C1]) → dynamic {}
@@ -148,12 +168,12 @@
: self::C::i = i, super core::Object::•()
;
constructor constructor5([core::int? i = #C1]) → self::C
- : self::C::i = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:81:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+ : self::C::i = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:85:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
C.constructor5([int? i]) : this.i = i; // error
^" in i as{TypeError,ForNonNullableByDefault} core::int, super core::Object::•()
;
constructor constructor6({core::int? i = #C1}) → self::C
- : self::C::i = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:83:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+ : self::C::i = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:87:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
C.constructor6({int? i}) : this.i = i; // error
^" in i as{TypeError,ForNonNullableByDefault} core::int, super core::Object::•()
;
@@ -170,6 +190,10 @@
let dynamic #redirecting_factory = self::C::constructor6 in invalid-expression;
static factory factory7({required core::int i = #C1}) → self::C
let dynamic #redirecting_factory = self::C::constructor7 in invalid-expression;
+ static factory factory8([core::int i = #C1]) → self::C
+ return new self::C::constructor3();
+ static factory factory9({core::int i = #C1}) → self::C
+ return new self::C::constructor4();
method method3([core::int i = #C1]) → dynamic {}
method method4({core::int i = #C1}) → dynamic {}
method method5([core::int? i = #C1]) → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue42362.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue42362.dart.strong.transformed.expect
index c847fd5..b0359f3 100644
--- a/pkg/front_end/testcases/nnbd/issue42362.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue42362.dart.strong.transformed.expect
@@ -2,11 +2,11 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:41:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:45:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method3([int i]) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:43:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:47:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method4({int i}) {} // error
// ^
//
@@ -26,30 +26,46 @@
// A.constructor4({int i}) // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:98:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:41:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory A.factory8([int i]) => new A.constructor3(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:43:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory A.factory9({int i}) => new A.constructor4(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:106:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method3([i]) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:100:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:108:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method4({i}) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:73:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:77:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor1([this.i]); // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:75:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:79:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor2({this.i}); // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:77:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:81:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor3([int i]) : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:79:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:83:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor4({int i}) : this.i = i; // error
// ^
//
+// pkg/front_end/testcases/nnbd/issue42362.dart:102:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.factory8([int i]) => new C.constructor3(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:104:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.factory9({int i}) => new C.constructor4(); // error
+// ^
+//
// pkg/front_end/testcases/nnbd/issue42362.dart:19:18: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// : this.i = i; // error
// ^
@@ -58,11 +74,11 @@
// : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:81:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/nnbd/issue42362.dart:85:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// C.constructor5([int? i]) : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:83:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/nnbd/issue42362.dart:87:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// C.constructor6({int? i}) : this.i = i; // error
// ^
//
@@ -113,6 +129,10 @@
let<BottomType> #redirecting_factory = self::A::constructor6 in invalid-expression;
static factory factory7({required core::int i = #C1}) → self::A
let<BottomType> #redirecting_factory = self::A::constructor7 in invalid-expression;
+ static factory factory8([core::int i = #C1]) → self::A
+ return new self::A::constructor3();
+ static factory factory9({core::int i = #C1}) → self::A
+ return new self::A::constructor4();
method method3([core::int i = #C1]) → dynamic {}
method method4({core::int i = #C1}) → dynamic {}
method method5([core::int? i = #C1]) → dynamic {}
@@ -148,12 +168,12 @@
: self::C::i = i, super core::Object::•()
;
constructor constructor5([core::int? i = #C1]) → self::C
- : self::C::i = let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:81:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+ : self::C::i = let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:85:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
C.constructor5([int? i]) : this.i = i; // error
^" in let core::int? #t6 = i in #t6.==(null) ?{core::int} #t6 as{TypeError,ForNonNullableByDefault} core::int : #t6{core::int}, super core::Object::•()
;
constructor constructor6({core::int? i = #C1}) → self::C
- : self::C::i = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:83:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+ : self::C::i = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:87:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
C.constructor6({int? i}) : this.i = i; // error
^" in let core::int? #t8 = i in #t8.==(null) ?{core::int} #t8 as{TypeError,ForNonNullableByDefault} core::int : #t8{core::int}, super core::Object::•()
;
@@ -170,6 +190,10 @@
let<BottomType> #redirecting_factory = self::C::constructor6 in invalid-expression;
static factory factory7({required core::int i = #C1}) → self::C
let<BottomType> #redirecting_factory = self::C::constructor7 in invalid-expression;
+ static factory factory8([core::int i = #C1]) → self::C
+ return new self::C::constructor3();
+ static factory factory9({core::int i = #C1}) → self::C
+ return new self::C::constructor4();
method method3([core::int i = #C1]) → dynamic {}
method method4({core::int i = #C1}) → dynamic {}
method method5([core::int? i = #C1]) → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue42362.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/issue42362.dart.textual_outline.expect
index 7110b99..3b84fcc 100644
--- a/pkg/front_end/testcases/nnbd/issue42362.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nnbd/issue42362.dart.textual_outline.expect
@@ -14,6 +14,8 @@
factory A.factory5([int? i]) = A.constructor5;
factory A.factory6({int? i}) = A.constructor6;
factory A.factory7({required int i}) = A.constructor7;
+ factory A.factory8([int i]) => new A.constructor3();
+ factory A.factory9({int i}) => new A.constructor4();
method3([int i]) {}
method4({int i}) {}
method5([int? i]) {}
@@ -46,6 +48,8 @@
factory C.factory5([int? i]) = C.constructor5;
factory C.factory6({int? i}) = C.constructor6;
factory C.factory7({required int i}) = C.constructor7;
+ factory C.factory8([int i]) => new C.constructor3();
+ factory C.factory9({int i}) => new C.constructor4();
method3([i]) {}
method4({i}) {}
method5([i]) {}
diff --git a/pkg/front_end/testcases/nnbd/issue42362.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/issue42362.dart.textual_outline_modelled.expect
index 294d4f9..312fbae 100644
--- a/pkg/front_end/testcases/nnbd/issue42362.dart.textual_outline_modelled.expect
+++ b/pkg/front_end/testcases/nnbd/issue42362.dart.textual_outline_modelled.expect
@@ -24,6 +24,8 @@
factory A.factory5([int? i]) = A.constructor5;
factory A.factory6({int? i}) = A.constructor6;
factory A.factory7({required int i}) = A.constructor7;
+ factory A.factory8([int i]) => new A.constructor3();
+ factory A.factory9({int i}) => new A.constructor4();
final int i;
method3([int i]) {}
method4({int i}) {}
@@ -45,6 +47,8 @@
factory C.factory5([int? i]) = C.constructor5;
factory C.factory6({int? i}) = C.constructor6;
factory C.factory7({required int i}) = C.constructor7;
+ factory C.factory8([int i]) => new C.constructor3();
+ factory C.factory9({int i}) => new C.constructor4();
method3([i]) {}
method4({i}) {}
method5([i]) {}
diff --git a/pkg/front_end/testcases/nnbd/issue42362.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue42362.dart.weak.expect
index 7579211..212d75b 100644
--- a/pkg/front_end/testcases/nnbd/issue42362.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/issue42362.dart.weak.expect
@@ -2,11 +2,11 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:41:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:45:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method3([int i]) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:43:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:47:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method4({int i}) {} // error
// ^
//
@@ -26,30 +26,46 @@
// A.constructor4({int i}) // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:98:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:41:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory A.factory8([int i]) => new A.constructor3(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:43:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory A.factory9({int i}) => new A.constructor4(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:106:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method3([i]) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:100:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:108:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method4({i}) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:73:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:77:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor1([this.i]); // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:75:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:79:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor2({this.i}); // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:77:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:81:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor3([int i]) : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:79:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:83:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor4({int i}) : this.i = i; // error
// ^
//
+// pkg/front_end/testcases/nnbd/issue42362.dart:102:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.factory8([int i]) => new C.constructor3(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:104:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.factory9({int i}) => new C.constructor4(); // error
+// ^
+//
// pkg/front_end/testcases/nnbd/issue42362.dart:19:18: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// : this.i = i; // error
// ^
@@ -58,11 +74,11 @@
// : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:81:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/nnbd/issue42362.dart:85:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// C.constructor5([int? i]) : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:83:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/nnbd/issue42362.dart:87:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// C.constructor6({int? i}) : this.i = i; // error
// ^
//
@@ -113,6 +129,10 @@
let dynamic #redirecting_factory = self::A::constructor6 in invalid-expression;
static factory factory7({required core::int i = #C1}) → self::A
let dynamic #redirecting_factory = self::A::constructor7 in invalid-expression;
+ static factory factory8([core::int i = #C1]) → self::A
+ return new self::A::constructor3();
+ static factory factory9({core::int i = #C1}) → self::A
+ return new self::A::constructor4();
method method3([core::int i = #C1]) → dynamic {}
method method4({core::int i = #C1}) → dynamic {}
method method5([core::int? i = #C1]) → dynamic {}
@@ -148,12 +168,12 @@
: self::C::i = i, super core::Object::•()
;
constructor constructor5([core::int? i = #C1]) → self::C
- : self::C::i = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:81:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+ : self::C::i = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:85:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
C.constructor5([int? i]) : this.i = i; // error
^" in i as{TypeError,ForNonNullableByDefault} core::int, super core::Object::•()
;
constructor constructor6({core::int? i = #C1}) → self::C
- : self::C::i = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:83:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+ : self::C::i = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:87:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
C.constructor6({int? i}) : this.i = i; // error
^" in i as{TypeError,ForNonNullableByDefault} core::int, super core::Object::•()
;
@@ -170,6 +190,10 @@
let dynamic #redirecting_factory = self::C::constructor6 in invalid-expression;
static factory factory7({required core::int i = #C1}) → self::C
let dynamic #redirecting_factory = self::C::constructor7 in invalid-expression;
+ static factory factory8([core::int i = #C1]) → self::C
+ return new self::C::constructor3();
+ static factory factory9({core::int i = #C1}) → self::C
+ return new self::C::constructor4();
method method3([core::int i = #C1]) → dynamic {}
method method4({core::int i = #C1}) → dynamic {}
method method5([core::int? i = #C1]) → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue42362.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue42362.dart.weak.transformed.expect
index d5a0891..6b13d7b 100644
--- a/pkg/front_end/testcases/nnbd/issue42362.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/issue42362.dart.weak.transformed.expect
@@ -2,11 +2,11 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:41:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:45:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method3([int i]) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:43:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:47:16: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method4({int i}) {} // error
// ^
//
@@ -26,30 +26,46 @@
// A.constructor4({int i}) // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:98:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:41:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory A.factory8([int i]) => new A.constructor3(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:43:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory A.factory9({int i}) => new A.constructor4(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:106:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method3([i]) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:100:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:108:12: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// method4({i}) {} // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:73:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:77:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor1([this.i]); // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:75:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:79:24: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor2({this.i}); // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:77:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:81:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor3([int i]) : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:79:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// pkg/front_end/testcases/nnbd/issue42362.dart:83:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
// C.constructor4({int i}) : this.i = i; // error
// ^
//
+// pkg/front_end/testcases/nnbd/issue42362.dart:102:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.factory8([int i]) => new C.constructor3(); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue42362.dart:104:27: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.factory9({int i}) => new C.constructor4(); // error
+// ^
+//
// pkg/front_end/testcases/nnbd/issue42362.dart:19:18: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// : this.i = i; // error
// ^
@@ -58,11 +74,11 @@
// : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:81:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/nnbd/issue42362.dart:85:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// C.constructor5([int? i]) : this.i = i; // error
// ^
//
-// pkg/front_end/testcases/nnbd/issue42362.dart:83:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+// pkg/front_end/testcases/nnbd/issue42362.dart:87:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
// C.constructor6({int? i}) : this.i = i; // error
// ^
//
@@ -113,6 +129,10 @@
let<BottomType> #redirecting_factory = self::A::constructor6 in invalid-expression;
static factory factory7({required core::int i = #C1}) → self::A
let<BottomType> #redirecting_factory = self::A::constructor7 in invalid-expression;
+ static factory factory8([core::int i = #C1]) → self::A
+ return new self::A::constructor3();
+ static factory factory9({core::int i = #C1}) → self::A
+ return new self::A::constructor4();
method method3([core::int i = #C1]) → dynamic {}
method method4({core::int i = #C1}) → dynamic {}
method method5([core::int? i = #C1]) → dynamic {}
@@ -148,12 +168,12 @@
: self::C::i = i, super core::Object::•()
;
constructor constructor5([core::int? i = #C1]) → self::C
- : self::C::i = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:81:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+ : self::C::i = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:85:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
C.constructor5([int? i]) : this.i = i; // error
^" in i, super core::Object::•()
;
constructor constructor6({core::int? i = #C1}) → self::C
- : self::C::i = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:83:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
+ : self::C::i = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/issue42362.dart:87:39: Error: A value of type 'int?' can't be assigned to a variable of type 'int'.
C.constructor6({int? i}) : this.i = i; // error
^" in i, super core::Object::•()
;
@@ -170,6 +190,10 @@
let<BottomType> #redirecting_factory = self::C::constructor6 in invalid-expression;
static factory factory7({required core::int i = #C1}) → self::C
let<BottomType> #redirecting_factory = self::C::constructor7 in invalid-expression;
+ static factory factory8([core::int i = #C1]) → self::C
+ return new self::C::constructor3();
+ static factory factory9({core::int i = #C1}) → self::C
+ return new self::C::constructor4();
method method3([core::int i = #C1]) → dynamic {}
method method4({core::int i = #C1}) → dynamic {}
method method5([core::int? i = #C1]) → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue43276.dart b/pkg/front_end/testcases/nnbd/issue43276.dart
new file mode 100644
index 0000000..e3dded5
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43276.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2020, 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 C {
+ C.gen({int i}); // error
+
+ factory C.fact({int i}) /* error */ {
+ return new C.gen();
+ }
+
+ factory C.redirect({int i}) = C.gen; // ok
+}
+
+class D {}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue43276.dart.outline.expect b/pkg/front_end/testcases/nnbd/issue43276.dart.outline.expect
new file mode 100644
index 0000000..46f5c3e
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43276.dart.outline.expect
@@ -0,0 +1,30 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/issue43276.dart:6:14: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// C.gen({int i}); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43276.dart:8:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.fact({int i}) /* error */ {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::C::redirect]/*isNullableByDefault*/;
+ constructor gen({core::int i}) → self::C
+ ;
+ static factory fact({core::int i}) → self::C
+ ;
+ static factory redirect({core::int i}) → self::C
+ let dynamic #redirecting_factory = self::C::gen in invalid-expression;
+}
+class D extends core::Object {
+ synthetic constructor •() → self::D
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/nnbd/issue43276.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue43276.dart.strong.expect
new file mode 100644
index 0000000..a827c7e
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43276.dart.strong.expect
@@ -0,0 +1,36 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/issue43276.dart:6:14: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// C.gen({int i}); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43276.dart:8:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.fact({int i}) /* error */ {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::C::redirect]/*isNullableByDefault*/;
+ constructor gen({core::int i = #C1}) → self::C
+ : super core::Object::•()
+ ;
+ static factory fact({core::int i = #C1}) → self::C {
+ return new self::C::gen();
+ }
+ static factory redirect({core::int i = #C1}) → self::C
+ let dynamic #redirecting_factory = self::C::gen in invalid-expression;
+}
+class D extends core::Object {
+ synthetic constructor •() → self::D
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/nnbd/issue43276.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue43276.dart.strong.transformed.expect
new file mode 100644
index 0000000..3a35612
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43276.dart.strong.transformed.expect
@@ -0,0 +1,36 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/issue43276.dart:6:14: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// C.gen({int i}); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43276.dart:8:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.fact({int i}) /* error */ {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::C::redirect]/*isNullableByDefault*/;
+ constructor gen({core::int i = #C1}) → self::C
+ : super core::Object::•()
+ ;
+ static factory fact({core::int i = #C1}) → self::C {
+ return new self::C::gen();
+ }
+ static factory redirect({core::int i = #C1}) → self::C
+ let<BottomType> #redirecting_factory = self::C::gen in invalid-expression;
+}
+class D extends core::Object {
+ synthetic constructor •() → self::D
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/nnbd/issue43276.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/issue43276.dart.textual_outline.expect
new file mode 100644
index 0000000..1cf1119
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43276.dart.textual_outline.expect
@@ -0,0 +1,9 @@
+class C {
+ C.gen({int i});
+ factory C.fact({int i}) {}
+ factory C.redirect({int i}) = C.gen;
+}
+
+class D {}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue43276.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/issue43276.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..1cf1119
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43276.dart.textual_outline_modelled.expect
@@ -0,0 +1,9 @@
+class C {
+ C.gen({int i});
+ factory C.fact({int i}) {}
+ factory C.redirect({int i}) = C.gen;
+}
+
+class D {}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue43276.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue43276.dart.weak.expect
new file mode 100644
index 0000000..a827c7e
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43276.dart.weak.expect
@@ -0,0 +1,36 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/issue43276.dart:6:14: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// C.gen({int i}); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43276.dart:8:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.fact({int i}) /* error */ {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::C::redirect]/*isNullableByDefault*/;
+ constructor gen({core::int i = #C1}) → self::C
+ : super core::Object::•()
+ ;
+ static factory fact({core::int i = #C1}) → self::C {
+ return new self::C::gen();
+ }
+ static factory redirect({core::int i = #C1}) → self::C
+ let dynamic #redirecting_factory = self::C::gen in invalid-expression;
+}
+class D extends core::Object {
+ synthetic constructor •() → self::D
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/testcases/nnbd/issue43276.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue43276.dart.weak.transformed.expect
new file mode 100644
index 0000000..3a35612
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43276.dart.weak.transformed.expect
@@ -0,0 +1,36 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/nnbd/issue43276.dart:6:14: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// C.gen({int i}); // error
+// ^
+//
+// pkg/front_end/testcases/nnbd/issue43276.dart:8:23: Error: Optional parameter 'i' should have a default value because its type 'int' doesn't allow null.
+// factory C.fact({int i}) /* error */ {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::C::redirect]/*isNullableByDefault*/;
+ constructor gen({core::int i = #C1}) → self::C
+ : super core::Object::•()
+ ;
+ static factory fact({core::int i = #C1}) → self::C {
+ return new self::C::gen();
+ }
+ static factory redirect({core::int i = #C1}) → self::C
+ let<BottomType> #redirecting_factory = self::C::gen in invalid-expression;
+}
+class D extends core::Object {
+ synthetic constructor •() → self::D
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
+
+constants {
+ #C1 = null
+}
diff --git a/pkg/front_end/tool/parser_direct_ast/console_helper.dart b/pkg/front_end/tool/parser_direct_ast/console_helper.dart
index e41eac3..d6a1d34 100644
--- a/pkg/front_end/tool/parser_direct_ast/console_helper.dart
+++ b/pkg/front_end/tool/parser_direct_ast/console_helper.dart
@@ -2,47 +2,58 @@
// 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.
-import "dart:async";
-import "dart:io";
-import "dart:isolate";
+import "dart:async" show StreamSubscription, Timer;
+import "dart:io" show Platform, ProcessSignal, exit, stdin, stdout;
+import "dart:isolate" show RawReceivePort;
+import "dart:typed_data" show Uint16List;
class Application {
- int lastKnownTerminalColumns;
- int lastKnownTerminalLines;
- RawReceivePort preventClose;
- StreamSubscription<List<int>> stdinListen;
- StreamSubscription<ProcessSignal> sigintListen;
- StreamSubscription<ProcessSignal> sigwinchListen;
- Timer timer;
- final Widget widget;
- bool started = false;
+ int _latestKnownTerminalColumns;
+ int _latestKnownTerminalRows;
+ RawReceivePort _preventClose;
+ StreamSubscription<List<int>> _stdinListen;
+ StreamSubscription<ProcessSignal> _sigintListen;
+ StreamSubscription<ProcessSignal> _sigwinchListen;
+ Timer _timer;
+ final Widget _widget;
+ _Output _output;
+ bool _started = false;
- Application(this.widget) {
- lastKnownTerminalColumns = stdout.terminalColumns;
- lastKnownTerminalLines = stdout.terminalLines;
- preventClose = new RawReceivePort();
+ Application(this._widget) {
+ _latestKnownTerminalColumns = stdout.terminalColumns;
+ _latestKnownTerminalRows = stdout.terminalLines;
+ _preventClose = new RawReceivePort();
stdin.echoMode = false;
stdin.lineMode = false;
- stdinListen = stdin.listen(stdinListener);
- sigintListen = ProcessSignal.sigint.watch().listen((ProcessSignal signal) {
+ _stdinListen = stdin.listen(_stdinListener);
+ _sigintListen = ProcessSignal.sigint.watch().listen((ProcessSignal signal) {
quit();
exit(0);
});
if (!Platform.isWindows) {
- sigwinchListen =
+ _sigwinchListen =
ProcessSignal.sigwinch.watch().listen((ProcessSignal signal) {
- lastKnownTerminalColumns = stdout.terminalColumns;
- lastKnownTerminalLines = stdout.terminalLines;
- clearScreenAlt();
- widget.print(this);
+ _latestKnownTerminalColumns = stdout.terminalColumns;
+ _latestKnownTerminalRows = stdout.terminalLines;
+ _repaint();
});
}
}
- void stdinListener(List<int> data) {
+ void _repaint() {
+ _output =
+ new _Output(_latestKnownTerminalRows, _latestKnownTerminalColumns);
+ _widget.print(new WriteOnlyPartialOutput(
+ _output, 0, 0, _output.rows, _output.columns));
+ _printOutput();
+ }
+
+ void _stdinListener(List<int> data) {
try {
- widget.input(this, data);
+ if (_widget.input(this, data)) {
+ _repaint();
+ }
} catch (e) {
quit();
rethrow;
@@ -50,247 +61,440 @@
}
void quit() {
- gotoMainScreenBuffer();
- showCursor();
- // clearScreenAlt();
- timer.cancel();
- preventClose.close();
- stdinListen.cancel();
- sigintListen.cancel();
- sigwinchListen?.cancel();
+ _gotoMainScreenBuffer();
+ _showCursor();
+ _timer.cancel();
+ _preventClose.close();
+ _stdinListen.cancel();
+ _sigintListen.cancel();
+ _sigwinchListen?.cancel();
}
void start() {
- if (started) throw "Already started!";
- started = true;
+ if (_started) throw "Already started!";
+ _started = true;
- gotoAlternativeScreenBuffer();
- hideCursor();
- // clearScreen();
- widget.print(this);
- timer = new Timer.periodic(new Duration(milliseconds: 100), (t) {
- var x = stdout.terminalColumns;
+ _gotoAlternativeScreenBuffer();
+ _hideCursor();
+ _repaint();
+
+ _timer = new Timer.periodic(new Duration(milliseconds: 100), (t) {
+ int value = stdout.terminalColumns;
bool changed = false;
- if (x != lastKnownTerminalColumns) {
- lastKnownTerminalColumns = x;
+ if (value != _latestKnownTerminalColumns) {
+ _latestKnownTerminalColumns = value;
changed = true;
}
- x = stdout.terminalLines;
- if (x != lastKnownTerminalLines) {
- lastKnownTerminalLines = x;
+ value = stdout.terminalLines;
+ if (value != _latestKnownTerminalRows) {
+ _latestKnownTerminalRows = value;
changed = true;
}
if (changed) {
- clearScreenAlt();
- widget.print(this);
+ _repaint();
}
});
}
+
+ _Output _prevOutput;
+
+ _printOutput() {
+ int currentPosRow = -1;
+ int currentPosColumn = -1;
+ StringBuffer buffer = new StringBuffer();
+ if (_prevOutput == null ||
+ _prevOutput.columns != _output.columns ||
+ _prevOutput.rows != _output.rows) {
+ _clearScreenAlt();
+ _prevOutput = null;
+ }
+ for (int row = 0; row < _output.rows; row++) {
+ for (int column = 0; column < _output.columns; column++) {
+ String char = _output.getChar(row, column);
+ int rawModifier = _output.getRawModifiers(row, column);
+
+ if (_prevOutput != null) {
+ String prevChar = _prevOutput.getChar(row, column);
+ int prevRawModifier = _prevOutput.getRawModifiers(row, column);
+ if (prevChar == char && prevRawModifier == rawModifier) continue;
+ }
+
+ Modifier modifier = _output.getModifier(row, column);
+ switch (modifier) {
+ case Modifier.Undefined:
+ // Do nothing.
+ break;
+ case Modifier.Bold:
+ buffer.write("${CSI}1m");
+ break;
+ case Modifier.Italic:
+ buffer.write("${CSI}3m");
+ break;
+ case Modifier.Underline:
+ buffer.write("${CSI}4m");
+ break;
+ }
+
+ ForegroundColor foregroundColor =
+ _output.getForegroundColor(row, column);
+ switch (foregroundColor) {
+ case ForegroundColor.Undefined:
+ // Do nothing.
+ break;
+ case ForegroundColor.Black:
+ buffer.write("${CSI}30m");
+ break;
+ case ForegroundColor.Red:
+ buffer.write("${CSI}31m");
+ break;
+ case ForegroundColor.Green:
+ buffer.write("${CSI}32m");
+ break;
+ case ForegroundColor.Yellow:
+ buffer.write("${CSI}33m");
+ break;
+ case ForegroundColor.Blue:
+ buffer.write("${CSI}34m");
+ break;
+ case ForegroundColor.Magenta:
+ buffer.write("${CSI}35m");
+ break;
+ case ForegroundColor.Cyan:
+ buffer.write("${CSI}36m");
+ break;
+ case ForegroundColor.White:
+ buffer.write("${CSI}37m");
+ break;
+ }
+
+ BackgroundColor backgroundColor =
+ _output.getBackgroundColor(row, column);
+ switch (backgroundColor) {
+ case BackgroundColor.Undefined:
+ // Do nothing.
+ break;
+ case BackgroundColor.Black:
+ buffer.write("${CSI}40m");
+ break;
+ case BackgroundColor.Red:
+ buffer.write("${CSI}41m");
+ break;
+ case BackgroundColor.Green:
+ buffer.write("${CSI}42m");
+ break;
+ case BackgroundColor.Yellow:
+ buffer.write("${CSI}43m");
+ break;
+ case BackgroundColor.Blue:
+ buffer.write("${CSI}44m");
+ break;
+ case BackgroundColor.Magenta:
+ buffer.write("${CSI}45m");
+ break;
+ case BackgroundColor.Cyan:
+ buffer.write("${CSI}46m");
+ break;
+ case BackgroundColor.White:
+ buffer.write("${CSI}47m");
+ break;
+ }
+
+ if (char != null) {
+ buffer.write(char);
+ } else {
+ buffer.write(" ");
+ }
+
+ // End old modifier.
+ buffer.write("${CSI}0m");
+
+ if (currentPosRow != row || currentPosColumn != column) {
+ // 1-indexed.
+ _setCursorPosition(row + 1, column + 1);
+ }
+ stdout.write(buffer.toString());
+ buffer.clear();
+ currentPosRow = row;
+ currentPosColumn = column + 1;
+ }
+ }
+
+ _prevOutput = _output;
+ }
+
+ // "ESC [" is "Control Sequence Introducer" (CSI) according to Wikipedia
+ // (https://en.wikipedia.org/wiki/ANSI_escape_code#Escape_sequences).
+ static const String CSI = "\x1b[";
+
+ void _setCursorPosition(int row, int column) {
+ // "CSI n ; m H": Cursor Position.
+ stdout.write("${CSI}${row};${column}H");
+ }
+
+ void _gotoAlternativeScreenBuffer() {
+ // "CSI ? 1049 h": Enable alternative screen buffer.
+ stdout.write("${CSI}?1049h");
+ }
+
+ void _gotoMainScreenBuffer() {
+ // "CSI ? 1049 l": Disable alternative screen buffer.
+ stdout.write("${CSI}?1049l");
+ }
+
+ void _clearScreenAlt() {
+ _setCursorPosition(0, 0);
+ // "CSI n J": Erase in Display. Clears part of the screen.
+ // If n is 0 (or missing), clear from cursor to end of screen.
+ stdout.write("${CSI}0J");
+ _setCursorPosition(0, 0);
+ }
+
+ void _hideCursor() {
+ // "CSI ? 25 l": DECTCEM Hides the cursor.
+ stdout.write("${CSI}?25l");
+ }
+
+ void _showCursor() {
+ // "CSI ? 25 h": DECTCEM Shows the cursor, from the VT320.
+ stdout.write("${CSI}?25h");
+ }
}
abstract class Widget {
- void print(Application app);
-
- void input(Application app, List<int> data) {}
+ void print(WriteOnlyOutput output);
+ bool input(Application app, List<int> data);
}
-// "ESC [" is "Control Sequence Introducer" (CSI) according to Wikipedia
-// (https://en.wikipedia.org/wiki/ANSI_escape_code#Escape_sequences).
-const String CSI = "\x1b[";
+class BoxedWidget extends Widget {
+ final Widget _content;
+ BoxedWidget(this._content);
-void setCursorPosition(int row, int column) {
- // "CSI n ; m H": Cursor Position.
- stdout.write("${CSI}${row};${column}H");
-}
-
-void gotoAlternativeScreenBuffer() {
- // "CSI ? 1049 h": Enable alternative screen buffer.
- stdout.write("${CSI}?1049h");
-}
-
-void gotoMainScreenBuffer() {
- // "CSI ? 1049 l": Disable alternative screen buffer.
- stdout.write("${CSI}?1049l");
-}
-
-void clearScreen() {
- // "CSI n J": Erase in Display. Clears part of the screen.
- // If n is 2, clear entire screen [...].
- stdout.write("${CSI}2J");
- setCursorPosition(0, 0);
-}
-
-void clearScreenAlt() {
- setCursorPosition(0, 0);
- // "CSI n J": Erase in Display. Clears part of the screen.
- // If n is 0 (or missing), clear from cursor to end of screen.
- stdout.write("${CSI}0J");
- setCursorPosition(0, 0);
-}
-
-void hideCursor() {
- // "CSI ? 25 l": DECTCEM Hides the cursor.
- stdout.write("${CSI}?25l");
-}
-
-void showCursor() {
- // "CSI ? 25 h": DECTCEM Shows the cursor, from the VT320.
- stdout.write("${CSI}?25h");
-}
-
-void printAt(int row, int column, String s) {
- setCursorPosition(row, column);
- stdout.write(s);
- setCursorPosition(stdout.terminalLines, stdout.terminalColumns);
-}
-
-String colorStringBlack(String s) {
- // "CSI n m": Select Graphic Rendition.
- // m = 0 = Reset / Normal.
- // In in range [30, 37]: Set foreground color.
- // m = 30 = black.
- // In total => start black; print string; reset colors.
- return "${CSI}30m${s}${CSI}0m";
-}
-
-String colorStringRed(String s) {
- // See above.
- // m = 31 = red.
- return "${CSI}31m${s}${CSI}0m";
-}
-
-String colorStringGreen(String s) {
- // See above.
- // m = 32 = green.
- return "${CSI}32m${s}${CSI}0m";
-}
-
-String colorStringYellow(String s) {
- // See above.
- // m = 33 = yellow.
- return "${CSI}33m${s}${CSI}0m";
-}
-
-String colorStringBlue(String s) {
- // See above.
- // m = 34 = blue.
- return "${CSI}34m${s}${CSI}0m";
-}
-
-String colorStringMagenta(String s) {
- // See above.
- // m = 35 = magenta.
- return "${CSI}35m${s}${CSI}0m";
-}
-
-String colorStringCyan(String s) {
- // See above.
- // m = 36 = cyan.
- return "${CSI}36m${s}${CSI}0m";
-}
-
-String colorStringWhite(String s) {
- // m = 37 = white.
- return "${CSI}37m${s}${CSI}0m";
-}
-
-String colorBackgroundBlack(String s) {
- // "CSI n m": Select Graphic Rendition.
- // m = 0 = Reset / Normal.
- // In in range [40, 47]: Set background color.
- // m = 40 = black.
- // In total => start black; print string; reset colors.
- return "${CSI}40m${s}${CSI}0m";
-}
-
-String colorBackgroundRed(String s) {
- // See above.
- // m = 41 = red.
- return "${CSI}41m${s}${CSI}0m";
-}
-
-String colorBackgroundGreen(String s) {
- // See above.
- // m = 42 = green.
- return "${CSI}42m${s}${CSI}0m";
-}
-
-String colorBackgroundYellow(String s) {
- // See above.
- // m = 43 = yellow.
- return "${CSI}43m${s}${CSI}0m";
-}
-
-String colorBackgroundBlue(String s) {
- // See above.
- // m = 44 = blue.
- return "${CSI}44m${s}${CSI}0m";
-}
-
-String colorBackgroundMagenta(String s) {
- // See above.
- // m = 45 = magenta.
- return "${CSI}45m${s}${CSI}0m";
-}
-
-String colorBackgroundCyan(String s) {
- // See above.
- // m = 46 = cyan.
- return "${CSI}46m${s}${CSI}0m";
-}
-
-String colorBackgroundWhite(String s) {
- // See above.
- // m = 47 = white.
- return "${CSI}47m${s}${CSI}0m";
-}
-
-String boldString(String s) {
- // "CSI n m": Select Graphic Rendition.
- // m = 0 = Reset / Normal.
- // m = 1 = bold.
- return "${CSI}1m${s}${CSI}0m";
-}
-
-String italicString(String s) {
- // "CSI n m": Select Graphic Rendition.
- // m = 0 = Reset / Normal.
- // m = 3 = italic.
- return "${CSI}3m${s}${CSI}0m";
-}
-
-/// Note that this doesn't really seem to work.
-/// Wikipedia says "Style extensions exist for Kitty, VTE, mintty and iTerm2."
-String underlineString(String s) {
- // "CSI n m": Select Graphic Rendition.
- // m = 0 = Reset / Normal.
- // m = 4 = italic.
- return "${CSI}4m${s}${CSI}0m";
-}
-
-void drawBox(int row, int column, int length, int height) {
- // Top line
- setCursorPosition(row, column);
- stdout.write("\u250c");
- stdout.write("".padLeft(length - 2, "\u2500"));
- stdout.write("\u2510");
-
- // Left line
- for (int i = 1; i < height - 1; i++) {
- setCursorPosition(row + i, column);
- stdout.write("\u2502");
+ @override
+ bool input(Application app, List<int> data) {
+ return _content?.input(app, data) ?? false;
}
- // Right line
- for (int i = 1; i < height - 1; i++) {
- setCursorPosition(row + i, column + length - 1);
- stdout.write("\u2502");
+ @override
+ void print(WriteOnlyOutput output) {
+ // Corners.
+ output.setCell(0, 0, char: /*"\u250c"*/ "\u250c");
+ output.setCell(0, output.columns - 1, char: "\u2510");
+ output.setCell(output.rows - 1, 0, char: "\u2514");
+ output.setCell(output.rows - 1, output.columns - 1, char: "\u2518");
+
+ // Top and bottom line.
+ for (int i = 1; i < output.columns - 1; i++) {
+ output.setCell(0, i, char: "\u2500");
+ output.setCell(output.rows - 1, i, char: "\u2500");
+ }
+
+ // Left and right line
+ for (int i = 1; i < output.rows - 1; i++) {
+ output.setCell(i, 0, char: "\u2502");
+ output.setCell(i, output.columns - 1, char: "\u2502");
+ }
+
+ // Reduce all sides by one.
+ _content?.print(new WriteOnlyPartialOutput(
+ output, 1, 1, output.rows - 2, output.columns - 2));
+ }
+}
+
+class QuitOnQWidget extends Widget {
+ Widget _contentWidget;
+
+ QuitOnQWidget(this._contentWidget);
+
+ @override
+ void print(WriteOnlyOutput output) {
+ _contentWidget?.print(output);
}
- // Bottom line
- setCursorPosition(row + height - 1, column);
- stdout.write("\u2514");
- stdout.write("".padLeft(length - 2, "\u2500"));
- stdout.write("\u2518");
+ @override
+ bool input(Application app, List<int> data) {
+ if (data.length == 1 && String.fromCharCode(data[0]) == 'q') {
+ app.quit();
+ return false;
+ }
+ return _contentWidget?.input(app, data) ?? false;
+ }
+}
+
+class WithSingleLineBottomWidget extends Widget {
+ Widget _contentWidget;
+ Widget _bottomWidget;
+
+ WithSingleLineBottomWidget(this._contentWidget, this._bottomWidget);
+
+ @override
+ void print(WriteOnlyOutput output) {
+ // All but the last row.
+ _contentWidget?.print(new WriteOnlyPartialOutput(
+ output, 0, 0, output.rows - 1, output.columns));
+
+ // Only that last row.
+ _bottomWidget?.print(new WriteOnlyPartialOutput(
+ output, output.rows - 1, 0, 1, output.columns));
+ }
+
+ @override
+ bool input(Application app, List<int> data) {
+ bool result = _contentWidget?.input(app, data) ?? false;
+ result |= _bottomWidget?.input(app, data) ?? false;
+ return result;
+ }
+}
+
+enum Modifier {
+ Undefined,
+ Bold,
+ Italic,
+ Underline,
+}
+
+enum ForegroundColor {
+ Undefined,
+ Black,
+ Red,
+ Green,
+ Yellow,
+ Blue,
+ Magenta,
+ Cyan,
+ White,
+}
+
+enum BackgroundColor {
+ Undefined,
+ Black,
+ Red,
+ Green,
+ Yellow,
+ Blue,
+ Magenta,
+ Cyan,
+ White,
+}
+
+class _Output implements WriteOnlyOutput {
+ final int rows;
+ final int columns;
+ final Uint16List _text;
+ final Uint16List _modifiers;
+
+ _Output(this.rows, this.columns)
+ : _text = new Uint16List(rows * columns),
+ _modifiers = new Uint16List(rows * columns);
+
+ int getPosition(int row, int column) {
+ return row * columns + column;
+ }
+
+ void setCell(int row, int column,
+ {String char,
+ Modifier modifier,
+ ForegroundColor foregroundColor,
+ BackgroundColor backgroundColor}) {
+ int position = getPosition(row, column);
+
+ if (char != null) {
+ List<int> codeUnits = char.codeUnits;
+ assert(codeUnits.length == 1);
+ _text[position] = codeUnits.single;
+ }
+
+ int outModifier = _modifiers[position];
+ if (modifier != null) {
+ int mask = 0x03 << 8;
+ int value = (modifier.index & 0x03) << 8;
+ outModifier &= ~mask;
+ outModifier |= value;
+ }
+ if (foregroundColor != null) {
+ int mask = 0xF << 4;
+ int value = (foregroundColor.index & 0xF) << 4;
+ outModifier &= ~mask;
+ outModifier |= value;
+ }
+ if (backgroundColor != null) {
+ int mask = 0xF;
+ int value = (backgroundColor.index & 0xF);
+ outModifier &= ~mask;
+ outModifier |= value;
+ }
+
+ _modifiers[position] = outModifier;
+ }
+
+ String getChar(int row, int column) {
+ int position = getPosition(row, column);
+ int char = _text[position];
+ if (char > 0) return new String.fromCharCode(char);
+ return null;
+ }
+
+ int getRawModifiers(int row, int column) {
+ int position = getPosition(row, column);
+ return _modifiers[position];
+ }
+
+ Modifier getModifier(int row, int column) {
+ int position = getPosition(row, column);
+ int modifier = _modifiers[position];
+ int value = (modifier >> 8) & 0x3;
+ return Modifier.values[value];
+ }
+
+ ForegroundColor getForegroundColor(int row, int column) {
+ int position = getPosition(row, column);
+ int modifier = _modifiers[position];
+ int value = (modifier >> 4) & 0xF;
+ return ForegroundColor.values[value];
+ }
+
+ BackgroundColor getBackgroundColor(int row, int column) {
+ int position = getPosition(row, column);
+ int modifier = _modifiers[position];
+ int value = modifier & 0xF;
+ return BackgroundColor.values[value];
+ }
+}
+
+abstract class WriteOnlyOutput {
+ int get rows;
+ int get columns;
+ void setCell(int row, int column,
+ {String char,
+ Modifier modifier,
+ ForegroundColor foregroundColor,
+ BackgroundColor backgroundColor});
+}
+
+class WriteOnlyPartialOutput implements WriteOnlyOutput {
+ final WriteOnlyOutput _output;
+ final int offsetRow;
+ final int offsetColumn;
+ final int rows;
+ final int columns;
+ WriteOnlyPartialOutput(this._output, this.offsetRow, this.offsetColumn,
+ this.rows, this.columns) {
+ if (offsetRow + rows > _output.rows ||
+ offsetColumn + columns > _output.columns) {
+ throw "Out of bounds";
+ }
+ }
+
+ @override
+ void setCell(int row, int column,
+ {String char,
+ Modifier modifier,
+ ForegroundColor foregroundColor,
+ BackgroundColor backgroundColor}) {
+ if (row >= rows || column >= columns) return;
+ _output.setCell(row + offsetRow, column + offsetColumn,
+ char: char,
+ foregroundColor: foregroundColor,
+ backgroundColor: backgroundColor);
+ }
}
diff --git a/pkg/front_end/tool/parser_direct_ast/viewer.dart b/pkg/front_end/tool/parser_direct_ast/viewer.dart
index 8dd3675..8bcf65e 100644
--- a/pkg/front_end/tool/parser_direct_ast/viewer.dart
+++ b/pkg/front_end/tool/parser_direct_ast/viewer.dart
@@ -2,10 +2,12 @@
// 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.
-import "dart:io";
-import 'dart:typed_data';
-import "package:front_end/src/fasta/util/direct_parser_ast.dart";
-import "package:front_end/src/fasta/util/direct_parser_ast_helper.dart";
+import "dart:io" show File, Platform;
+import "dart:typed_data" show Uint8List;
+
+import "package:front_end/src/fasta/util/direct_parser_ast.dart" show getAST;
+import "package:front_end/src/fasta/util/direct_parser_ast_helper.dart"
+ show DirectParserASTContent, DirectParserASTType;
import "console_helper.dart";
@@ -17,34 +19,18 @@
Uint8List bytes = new File.fromUri(uri).readAsBytesSync();
DirectParserASTContent ast = getAST(bytes);
- Widget widget = new PairWidget(new AstWidget(ast), new StatusBar());
+ Widget widget = new QuitOnQWidget(
+ new WithSingleLineBottomWidget(
+ new BoxedWidget(
+ new AstWidget(ast),
+ ),
+ new StatusBarWidget(),
+ ),
+ );
Application app = new Application(widget);
app.start();
}
-class PairWidget extends Widget {
- Widget first;
- Widget second;
-
- PairWidget(this.first, this.second);
-
- @override
- void print(Application app) {
- first.print(app);
- second.print(app);
- }
-
- @override
- void input(Application app, List<int> data) {
- if (data.length == 1 && String.fromCharCode(data[0]) == 'q') {
- app.quit();
- return;
- }
- first.input(app, data);
- second.input(app, data);
- }
-}
-
class PrintedLine {
final String text;
final DirectParserASTContent ast;
@@ -66,13 +52,9 @@
class AstWidget extends Widget {
List<PrintedLine> shown;
int selected = 0;
- int _latestSelected;
- List<PrintedLine> _latestShown;
AstWidget(DirectParserASTContent ast) {
shown = [new PrintedLine.ast(ast, textualize(ast))];
- _latestSelected = selected;
- _latestShown = shown;
}
String textualize(DirectParserASTContent element,
@@ -100,38 +82,30 @@
"${element.arguments.toString()}${extra}";
}
- void clear(Application app) {
- int realSelected = selected;
- selected = -1;
- for (int i = 0; i < app.lastKnownTerminalLines - 2; i++) {
- printLineText(app, "", i);
- }
- selected = realSelected;
- }
-
@override
- void print(Application app, {bool totalRepaint: true}) {
- if (!totalRepaint && _latestShown != shown) {
- totalRepaint = true;
- }
- if (!totalRepaint && selected == _latestSelected) {
- return;
- }
+ void print(WriteOnlyOutput output) {
+ for (int row = 0; row < shown.length; row++) {
+ if (row >= output.rows) break;
- if (totalRepaint) {
- clear(app);
- drawBox(
- 1, 1, app.lastKnownTerminalColumns, app.lastKnownTerminalLines - 1);
- for (int i = 0; i < shown.length; i++) {
- if (3 + i >= app.lastKnownTerminalLines) break;
- printLine(app, i);
+ PrintedLine element = shown[row];
+ String line = element.text;
+
+ if (selected == row) {
+ // Mark line with blue background.
+ for (int column = 0; column < output.columns; column++) {
+ output.setCell(row, column, backgroundColor: BackgroundColor.Blue);
+ }
}
- } else {
- printLine(app, _latestSelected);
- printLine(app, selected);
+
+ // Print text.
+ int length = line.length;
+ if (length > output.columns) {
+ length = output.columns;
+ }
+ for (int column = 0; column < length; column++) {
+ output.setCell(row, column, char: line[column]);
+ }
}
- _latestShown = shown;
- _latestSelected = selected;
}
void enter() {
@@ -155,69 +129,63 @@
}
}
- void printLine(Application app, int lineNum) {
- PrintedLine element = shown[lineNum];
- String line = element.text;
- printLineText(app, line, lineNum);
- }
-
- void printLineText(Application app, String line, int lineNum) {
- if (line.length > app.lastKnownTerminalColumns - 2) {
- line = line.substring(0, app.lastKnownTerminalColumns - 2);
- } else {
- line = line.padRight(app.lastKnownTerminalColumns - 2);
- }
- printAt(2 + lineNum, 2, ifSelected(line, selected == lineNum));
- }
-
- String ifSelected(String s, bool isSelected) {
- if (isSelected) return colorBackgroundBlue(s);
- return s;
- }
-
@override
- void input(Application app, List<int> data) {
+ bool input(_, List<int> data) {
if (data.length > 2 &&
- data[0] == CSI.codeUnitAt(0) &&
- data[1] == CSI.codeUnitAt(1)) {
+ data[0] == Application.CSI.codeUnitAt(0) &&
+ data[1] == Application.CSI.codeUnitAt(1)) {
// ANSI codes --- at least on my machine.
if (data[2] == 65 /* A */) {
// CSI _n_ A: Cursor Up (where n is optional defaulting to 1).
// Up arrow.
if (selected > 0) {
selected--;
+ return true;
}
} else if (data[2] == 66 /* B */) {
// CSI _n_ B: Cursor Down (where n is optional defaulting to 1).
// Down arrow.
if (selected < shown.length - 1) {
selected++;
+ return true;
}
}
} else if (data.length == 1 && data[0] == 10) {
// <Return>.
enter();
+ return true;
}
- print(app, totalRepaint: false);
+ return false;
}
}
-class StatusBar extends Widget {
+class StatusBarWidget extends Widget {
List<int> latestInput;
@override
- void print(Application app) {
+ void print(WriteOnlyOutput output) {
+ // Paint everything with a red background.
+ for (int row = 0; row < output.rows; row++) {
+ for (int column = 0; column < output.columns; column++) {
+ output.setCell(row, column, backgroundColor: BackgroundColor.Red);
+ }
+ }
+
String leftString = "> ${latestInput ?? ""}";
String rightString = "Press q or Ctrl-C to quit";
- int padding =
- app.lastKnownTerminalColumns - leftString.length - rightString.length;
- printAt(app.lastKnownTerminalLines, 1,
- colorBackgroundRed("$leftString${" " * padding}${rightString}"));
+ for (int i = 0; i < leftString.length; i++) {
+ output.setCell(0, i,
+ char: leftString[i], backgroundColor: BackgroundColor.Red);
+ }
+ for (int i = 0; i < rightString.length; i++) {
+ output.setCell(output.rows - 1, output.columns - rightString.length + i,
+ char: rightString[i], backgroundColor: BackgroundColor.Red);
+ }
}
@override
- void input(Application app, List<int> data) {
+ bool input(Application app, List<int> data) {
latestInput = data;
- print(app);
+ return true;
}
}
diff --git a/tools/VERSION b/tools/VERSION
index 3d05ed3..72296d4 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 10
PATCH 0
-PRERELEASE 82
+PRERELEASE 83
PRERELEASE_PATCH 0
\ No newline at end of file