mirror of
https://github.com/dart-lang/sdk
synced 2024-10-02 23:59:16 +00:00
[cfe] Adjust nullability of UP when r.h.s. is an intersection
Closes https://github.com/dart-lang/sdk/issues/48373 Change-Id: I9ec2211c6deccbc7c26e831863f9a9b05833380f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236601 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
This commit is contained in:
parent
be207fbc54
commit
ad3d2eb5c4
10
pkg/front_end/testcases/general/issue48373.dart
Normal file
10
pkg/front_end/testcases/general/issue48373.dart
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Copyright (c) 2022, 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.
|
||||
|
||||
void fn<T, S>(T? t, S? s) {
|
||||
var x = [t!, s!];
|
||||
List<Object> y = x; // Ok.
|
||||
}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,2 @@
|
|||
void fn<T, S>(T? t, S? s) {}
|
||||
main() {}
|
|
@ -0,0 +1,2 @@
|
|||
main() {}
|
||||
void fn<T, S>(T? t, S? s) {}
|
|
@ -0,0 +1,9 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method fn<T extends core::Object? = dynamic, S extends core::Object? = dynamic>(self::fn::T? t, self::fn::S? s) → void {
|
||||
core::List<core::Object> x = <core::Object>[t!, s!];
|
||||
core::List<core::Object> y = x;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,9 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method fn<T extends core::Object? = dynamic, S extends core::Object? = dynamic>(self::fn::T? t, self::fn::S? s) → void {
|
||||
core::List<core::Object> x = <core::Object>[t!, s!];
|
||||
core::List<core::Object> y = x;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,8 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method fn<T extends core::Object? = dynamic, S extends core::Object? = dynamic>(self::fn::T? t, self::fn::S? s) → void
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,9 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method fn<T extends core::Object? = dynamic, S extends core::Object? = dynamic>(self::fn::T? t, self::fn::S? s) → void {
|
||||
core::List<core::Object> x = core::_GrowableList::_literal2<core::Object>(t!, s!);
|
||||
core::List<core::Object> y = x;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -1274,8 +1274,7 @@ mixin StandardBounds {
|
|||
type2,
|
||||
clientLibrary)
|
||||
.withDeclaredNullability(uniteNullabilities(
|
||||
type1.promotedBound!.declaredNullability,
|
||||
type2.declaredNullability));
|
||||
type1.promotedBound!.declaredNullability, type2.nullability));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue