mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:19:48 +00:00
Set BinaryExpression.staticInvokeType properly for extension overrides.
Fixes #43114. Bug: https://github.com/dart-lang/sdk/issues/43114 Change-Id: Ib0adf67c5ac5189732960a5925d7cdbcff0c4102 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180441 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
parent
d0e1be5c99
commit
d4fb6b320c
|
@ -293,6 +293,7 @@ class BinaryExpressionResolver {
|
|||
);
|
||||
}
|
||||
node.staticElement = member;
|
||||
node.staticInvokeType = member?.type;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -341,7 +341,6 @@ h(int x) {}
|
|||
[typeToStringWithNullability ? 'int' : 'num']);
|
||||
}
|
||||
|
||||
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/43114')
|
||||
test_plus_int_context_int_via_extension_explicit() async {
|
||||
await assertErrorsInCode('''
|
||||
extension E on int {
|
||||
|
@ -438,7 +437,6 @@ f(int Function() a, int b) {
|
|||
);
|
||||
}
|
||||
|
||||
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/43114')
|
||||
test_plus_int_int_via_extension_explicit() async {
|
||||
await assertNoErrorsInCode('''
|
||||
extension E on int {
|
||||
|
@ -511,7 +509,6 @@ h(int x) {}
|
|||
assertTypeArgumentTypes(findNode.methodInvocation('f()'), ['String']);
|
||||
}
|
||||
|
||||
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/43114')
|
||||
test_plus_other_context_int_via_extension_explicit() async {
|
||||
await assertErrorsInCode('''
|
||||
class A {}
|
||||
|
@ -568,7 +565,6 @@ f(A a, double b) {
|
|||
);
|
||||
}
|
||||
|
||||
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/43114')
|
||||
test_plus_other_int_via_extension_explicit() async {
|
||||
await assertNoErrorsInCode('''
|
||||
class A {}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
// 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.
|
||||
|
||||
/// Regression test for https://github.com/dart-lang/sdk/issues/43114.
|
||||
|
||||
class A {}
|
||||
|
||||
extension E on A {
|
||||
String operator +(int other) => '';
|
||||
}
|
||||
|
||||
f(A a, int b) {
|
||||
int i = E(a) + b;
|
||||
// ^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
|
||||
}
|
||||
|
||||
main() {
|
||||
f(A(), 0);
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// 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.
|
||||
|
||||
/// Regression test for https://github.com/dart-lang/sdk/issues/43114.
|
||||
|
||||
class A {}
|
||||
|
||||
extension E on A {
|
||||
String operator +(int other) => '';
|
||||
}
|
||||
|
||||
f(A a, int b) {
|
||||
int i = E(a) + b;
|
||||
// ^^^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// ^
|
||||
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
|
||||
}
|
||||
|
||||
main() {
|
||||
f(A(), 0);
|
||||
}
|
Loading…
Reference in a new issue