Skip to content

Commit 2369eca

Browse files
nshahanCommit Queue
authored and
Commit Queue
committed
[kernel] Fix legacy types appearing when sound
Calling these apis would return a legacy type even when compiling a program for sound null safety. Change-Id: Ia7f177ac7da09ddff865a4a935d06c4830f6da07 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327903 Commit-Queue: Nicholas Shahan <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
1 parent a013de8 commit 2369eca

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

pkg/front_end/test/fasta/types/dill_hierarchy_test.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,37 @@ Object:
4040
4141
A:
4242
superclasses:
43-
Object
43+
Object!
4444
4545
B:
4646
Longest path to Object: 2
4747
superclasses:
48-
Object
49-
interfaces: A
48+
Object!
49+
interfaces: A!
5050
5151
C:
5252
Longest path to Object: 2
5353
superclasses:
54-
Object
55-
interfaces: A
54+
Object!
55+
interfaces: A!
5656
5757
D:
5858
Longest path to Object: 3
5959
superclasses:
60-
Object
61-
interfaces: B<T%>, A, C<U%>
60+
Object!
61+
interfaces: B<T%>!, A!, C<U%>!
6262
6363
E:
6464
Longest path to Object: 4
6565
superclasses:
66-
Object
67-
interfaces: D<int!,double!>, B<int!>, A, C<double!>
66+
Object!
67+
interfaces: D<int!,double!>!, B<int!>!, A!, C<double!>!
6868
6969
F:
7070
Longest path to Object: 4
7171
superclasses:
72-
Object
73-
interfaces: D<int!,bool!>, B<int!>, A, C<bool!>
72+
Object!
73+
interfaces: D<int!,bool!>!, B<int!>!, A!, C<bool!>!
7474
""";
7575

7676
void main() {

pkg/kernel/lib/ast.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6597,10 +6597,10 @@ class ConstructorInvocation extends InvocationExpression {
65976597
// TODO(cstefantsova): Get raw type from a CoreTypes object if arguments is
65986598
// empty.
65996599
return arguments.types.isEmpty
6600-
? new InterfaceType(
6601-
enclosingClass, Nullability.legacy, const <DartType>[])
6602-
: new InterfaceType(
6603-
enclosingClass, Nullability.legacy, arguments.types);
6600+
? new InterfaceType(enclosingClass, target.enclosingLibrary.nonNullable,
6601+
const <DartType>[])
6602+
: new InterfaceType(enclosingClass, target.enclosingLibrary.nonNullable,
6603+
arguments.types);
66046604
}
66056605

66066606
@override
@@ -13123,7 +13123,8 @@ class Supertype extends Node {
1312313123
}
1312413124

1312513125
InterfaceType get asInterfaceType {
13126-
return new InterfaceType(classNode, Nullability.legacy, typeArguments);
13126+
return new InterfaceType(
13127+
classNode, classNode.enclosingLibrary.nonNullable, typeArguments);
1312713128
}
1312813129

1312913130
@override

0 commit comments

Comments
 (0)