mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:10:22 +00:00
[fasta] Fix bounds checking: non-generic types are always well-bounded
Change-Id: I745450f0d4c9a41f9df3e1dc97dd42cf25d69edc Reviewed-on: https://dart-review.googlesource.com/c/79681 Reviewed-by: Aske Simon Christensen <askesc@google.com> Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
This commit is contained in:
parent
0a986f3f80
commit
22b11717ac
2 changed files with 7 additions and 13 deletions
|
@ -220,7 +220,6 @@ class TypeEnvironment extends SubtypeTester {
|
|||
// to typedefs are preserved in the Kernel output.
|
||||
List<Object> findBoundViolations(DartType type,
|
||||
{bool allowSuperBounded = false,
|
||||
bool isCovariant = true,
|
||||
Map<FunctionType, List<DartType>> typedefInstantiations}) {
|
||||
List<TypeParameter> variables;
|
||||
List<DartType> arguments;
|
||||
|
@ -241,7 +240,6 @@ class TypeEnvironment extends SubtypeTester {
|
|||
typedefReference: null);
|
||||
typedefRhsResult = findBoundViolations(cloned,
|
||||
allowSuperBounded: true,
|
||||
isCovariant: isCovariant,
|
||||
typedefInstantiations: typedefInstantiations);
|
||||
type = new TypedefType(functionType.typedef, typedefInstantiations[type]);
|
||||
}
|
||||
|
@ -254,23 +252,26 @@ class TypeEnvironment extends SubtypeTester {
|
|||
arguments = type.typeArguments;
|
||||
} else if (type is FunctionType) {
|
||||
List<Object> result = <Object>[];
|
||||
for (TypeParameter parameter in type.typeParameters) {
|
||||
result.addAll(findBoundViolations(parameter.bound,
|
||||
allowSuperBounded: true,
|
||||
typedefInstantiations: typedefInstantiations) ??
|
||||
const <Object>[]);
|
||||
}
|
||||
for (DartType formal in type.positionalParameters) {
|
||||
result.addAll(findBoundViolations(formal,
|
||||
allowSuperBounded: true,
|
||||
isCovariant: !isCovariant,
|
||||
typedefInstantiations: typedefInstantiations) ??
|
||||
const <Object>[]);
|
||||
}
|
||||
for (NamedType named in type.namedParameters) {
|
||||
result.addAll(findBoundViolations(named.type,
|
||||
allowSuperBounded: true,
|
||||
isCovariant: !isCovariant,
|
||||
typedefInstantiations: typedefInstantiations) ??
|
||||
const <Object>[]);
|
||||
}
|
||||
result.addAll(findBoundViolations(type.returnType,
|
||||
allowSuperBounded: true,
|
||||
isCovariant: isCovariant,
|
||||
typedefInstantiations: typedefInstantiations) ??
|
||||
const <Object>[]);
|
||||
return result.isEmpty ? null : result;
|
||||
|
@ -296,7 +297,6 @@ class TypeEnvironment extends SubtypeTester {
|
|||
|
||||
List<Object> violations = findBoundViolations(arguments[i],
|
||||
allowSuperBounded: true,
|
||||
isCovariant: isCovariant,
|
||||
typedefInstantiations: typedefInstantiations);
|
||||
if (violations != null) {
|
||||
argumentsResult ??= <Object>[];
|
||||
|
@ -317,7 +317,7 @@ class TypeEnvironment extends SubtypeTester {
|
|||
if (!allowSuperBounded) return result;
|
||||
|
||||
result = null;
|
||||
type = convertSuperBoundedToRegularBounded(type, isCovariant: isCovariant);
|
||||
type = convertSuperBoundedToRegularBounded(type);
|
||||
List<DartType> argumentsToReport = arguments.toList();
|
||||
if (type is InterfaceType) {
|
||||
variables = type.classNode.typeParameters;
|
||||
|
@ -370,7 +370,6 @@ class TypeEnvironment extends SubtypeTester {
|
|||
|
||||
List<Object> violations = findBoundViolations(arguments[i],
|
||||
allowSuperBounded: true,
|
||||
isCovariant: true,
|
||||
typedefInstantiations: typedefInstantiations);
|
||||
if (violations != null) {
|
||||
result ??= <Object>[];
|
||||
|
|
|
@ -211,11 +211,6 @@ deferred_inheritance_constraints_test/implements: MissingCompileTimeError # Fast
|
|||
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
|
||||
f_bounded_quantification2_test: CompileTimeError # Issue 34583
|
||||
f_bounded_quantification4_test: CompileTimeError # Issue 34583
|
||||
instantiate_to_bounds_super_bounded_test/54: CompileTimeError # Issue 34613
|
||||
instantiate_to_bounds_super_bounded_test/55: CompileTimeError # Issue 34613
|
||||
instantiate_to_bounds_super_bounded_test/56: CompileTimeError # Issue 34613
|
||||
instantiate_to_bounds_super_bounded_test/57: CompileTimeError # Issue 34613
|
||||
instantiate_to_bounds_super_bounded_test/58: CompileTimeError # Issue 34613
|
||||
issue31596_super_test/02: MissingCompileTimeError # Issue 31596
|
||||
issue31596_super_test/04: MissingCompileTimeError # Issue 31596
|
||||
issue34488_test/01: MissingCompileTimeError # Issue 34488
|
||||
|
|
Loading…
Reference in a new issue