Skip to content

Commit

Permalink
Version 2.14.0-366.0.dev
Browse files Browse the repository at this point in the history
Merge commit 'ac137cf40ff1d5da95ec8e99653538b2ed6eef5b' into 'dev'
  • Loading branch information
Dart CI committed Jul 29, 2021
2 parents 54f1ff2 + ac137cf commit 6e821af
Show file tree
Hide file tree
Showing 31 changed files with 690 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,12 @@ class KernelTarget extends TargetImplementation {
// To report errors on the first definition of a constructor, we need to
// iterate until that last element.
ConstructorBuilder earliest = constructorBuilder;
while (earliest.next != null) {
earliest = earliest.next as ConstructorBuilder;
Builder earliestBuilder = constructorBuilder;
while (earliestBuilder.next != null) {
earliestBuilder = earliestBuilder.next!;
if (earliestBuilder is ConstructorBuilder) {
earliest = earliestBuilder;
}
}

bool isRedirecting = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
T func<T>(T value) => value;
var funcValue = func;
int Function(int) f = funcValue.call; // Disallowed!
int Function(int) g = funcValue.call<int>; // Disallowed!

test(Function f) {
int Function(int) g = f.call<int>; // Disallowed!
}

main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,29 @@ library /*isNonNullableByDefault*/;
// int Function(int) f = funcValue.call; // Disallowed!
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:11:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
// - 'Function' is from 'dart:core'.
// Try changing the operand or remove the type arguments.
// int Function(int) g = f.call<int>; // Disallowed!
// ^
//
import self as self;
import "dart:core" as core;

static field <T extends core::Object? = dynamic>(T%) → T% funcValue = #C1;
static field (core::int) → core::int f = let final Never #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:7:33: Error: A value of type 'T Function<T>(T)' can't be assigned to a variable of type 'int Function(int)'.
int Function(int) f = funcValue.call; // Disallowed!
^" in self::funcValue.call as{TypeError,ForNonNullableByDefault} (core::int) → core::int;
static field (core::int) → core::int g = self::funcValue.call<core::int>;
static method func<T extends core::Object? = dynamic>(self::func::T% value) → self::func::T%
return value;
static method test(core::Function f) → dynamic {
(core::int) → core::int g = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:11:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
- 'Function' is from 'dart:core'.
Try changing the operand or remove the type arguments.
int Function(int) g = f.call<int>; // Disallowed!
^";
}
static method main() → dynamic {}

constants {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
T func<T>(T value) => value;
var funcValue = func;
int Function(int) f = funcValue.call;
int Function(int) g = funcValue.call<int>;
test(Function f) {}
main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,29 @@ library /*isNonNullableByDefault*/;
// int Function(int) f = funcValue.call; // Disallowed!
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:11:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
// - 'Function' is from 'dart:core'.
// Try changing the operand or remove the type arguments.
// int Function(int) g = f.call<int>; // Disallowed!
// ^
//
import self as self;
import "dart:core" as core;

static field <T extends core::Object? = dynamic>(T%) → T% funcValue = #C1;
static field (core::int) → core::int f = let final Never #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:7:33: Error: A value of type 'T Function<T>(T)' can't be assigned to a variable of type 'int Function(int)'.
int Function(int) f = funcValue.call; // Disallowed!
^" in self::funcValue.call as{TypeError,ForNonNullableByDefault} (core::int) → core::int;
static field (core::int) → core::int g = self::funcValue.call<core::int>;
static method func<T extends core::Object? = dynamic>(self::func::T% value) → self::func::T%
return value;
static method test(core::Function f) → dynamic {
(core::int) → core::int g = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:11:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
- 'Function' is from 'dart:core'.
Try changing the operand or remove the type arguments.
int Function(int) g = f.call<int>; // Disallowed!
^";
}
static method main() → dynamic {}

constants {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import "dart:core" as core;

static field <T extends core::Object? = dynamic>(T%) → T% funcValue;
static field (core::int) → core::int f;
static field (core::int) → core::int g;
static method func<T extends core::Object? = dynamic>(self::func::T% value) → self::func::T%
;
static method test(core::Function f) → dynamic
;
static method main() → dynamic
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) 2021, 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.

test1(dynamic x) => x.foo<int>; // Error.
test2(Never x) => x.foo<int>; // Error.
test3(dynamic x) => x.toString<int>; // Error.
test4(Never x) => x.toString<int>; // Error.

main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// test1(dynamic x) => x.foo<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
// Try changing the operand or remove the type arguments.
// test2(Never x) => x.foo<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
// Try changing the operand or remove the type arguments.
// test3(dynamic x) => x.toString<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
// Try changing the operand or remove the type arguments.
// test4(Never x) => x.toString<int>; // Error.
// ^
//
import self as self;

static method test1(dynamic x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
test1(dynamic x) => x.foo<int>; // Error.
^";
static method test2(Never x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
Try changing the operand or remove the type arguments.
test2(Never x) => x.foo<int>; // Error.
^";
static method test3(dynamic x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
Try changing the operand or remove the type arguments.
test3(dynamic x) => x.toString<int>; // Error.
^";
static method test4(Never x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
Try changing the operand or remove the type arguments.
test4(Never x) => x.toString<int>; // Error.
^";
static method main() → dynamic {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// test1(dynamic x) => x.foo<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
// Try changing the operand or remove the type arguments.
// test2(Never x) => x.foo<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
// Try changing the operand or remove the type arguments.
// test3(dynamic x) => x.toString<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
// Try changing the operand or remove the type arguments.
// test4(Never x) => x.toString<int>; // Error.
// ^
//
import self as self;

static method test1(dynamic x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
test1(dynamic x) => x.foo<int>; // Error.
^";
static method test2(Never x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
Try changing the operand or remove the type arguments.
test2(Never x) => x.foo<int>; // Error.
^";
static method test3(dynamic x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
Try changing the operand or remove the type arguments.
test3(dynamic x) => x.toString<int>; // Error.
^";
static method test4(Never x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
Try changing the operand or remove the type arguments.
test4(Never x) => x.toString<int>; // Error.
^";
static method main() → dynamic {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test1(dynamic x) => x.foo<int>;
test2(Never x) => x.foo<int>;
test3(dynamic x) => x.toString<int>;
test4(Never x) => x.toString<int>;
main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// test1(dynamic x) => x.foo<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
// Try changing the operand or remove the type arguments.
// test2(Never x) => x.foo<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
// Try changing the operand or remove the type arguments.
// test3(dynamic x) => x.toString<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
// Try changing the operand or remove the type arguments.
// test4(Never x) => x.toString<int>; // Error.
// ^
//
import self as self;

static method test1(dynamic x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
test1(dynamic x) => x.foo<int>; // Error.
^";
static method test2(Never x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
Try changing the operand or remove the type arguments.
test2(Never x) => x.foo<int>; // Error.
^";
static method test3(dynamic x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
Try changing the operand or remove the type arguments.
test3(dynamic x) => x.toString<int>; // Error.
^";
static method test4(Never x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
Try changing the operand or remove the type arguments.
test4(Never x) => x.toString<int>; // Error.
^";
static method main() → dynamic {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
library /*isNonNullableByDefault*/;
import self as self;

static method test1(dynamic x) → dynamic
;
static method test2(Never x) → dynamic
;
static method test3(dynamic x) → dynamic
;
static method test4(Never x) → dynamic
;
static method main() → dynamic
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// test1(dynamic x) => x.foo<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
// Try changing the operand or remove the type arguments.
// test2(Never x) => x.foo<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
// Try changing the operand or remove the type arguments.
// test3(dynamic x) => x.toString<int>; // Error.
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
// Try changing the operand or remove the type arguments.
// test4(Never x) => x.toString<int>; // Error.
// ^
//
import self as self;

static method test1(dynamic x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
test1(dynamic x) => x.foo<int>; // Error.
^";
static method test2(Never x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
Try changing the operand or remove the type arguments.
test2(Never x) => x.foo<int>; // Error.
^";
static method test3(dynamic x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
Try changing the operand or remove the type arguments.
test3(dynamic x) => x.toString<int>; // Error.
^";
static method test4(Never x) → dynamic
return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
Try changing the operand or remove the type arguments.
test4(Never x) => x.toString<int>; // Error.
^";
static method main() → dynamic {}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,28 @@ class D {
D(); // Error.
}

class E1 {
E1._();
E1();
factory E1.new() => E1._(); // Error.
}

class E2 {
E2._();
factory E2.new() => E2._(); // Error.
E2();
}

class E3 {
E3._();
E3();
factory E3.new() = E3._; // Error.
}

class E4 {
E4._();
factory E4.new() = E4._;
E4(); // Error.
}

main() {}
Loading

0 comments on commit 6e821af

Please sign in to comment.