Files
sdk/tests/language/inference/inconsistent_inheritance_test.dart
T
Johnni Winther 8103c90dbf [cfe] Use combined member signature in override inference in legacy code
+ emit only one message per method given that it now always has the
same root cause, namely that the combined member signature does not
exist.

Closes #31797

Change-Id: Id89a5557c5fdda1db087c20cbe92847dd08216a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175305
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-12-09 17:33:20 +00:00

36 lines
869 B
Dart

// Copyright (c) 2017, 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 A {
void f(Object x) {}
void g(Object x, String y) {}
}
class B {
void f(String x) {}
void g(String x, Object y) {}
}
class C extends A implements B {
void f(x) {
// Infers Object for x.
Object y = x;
String z = x;
// ^
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
// [cfe] A value of type 'Object' can't be assigned to a variable of type 'String'.
}
// No combined signature.
void g(x, y) {
// ^
// [analyzer] COMPILE_TIME_ERROR.NO_COMBINED_SUPER_SIGNATURE
// [cfe] Can't infer types for 'g' as the overridden members don't have a combined signature.
}
}
void main() {}