blob: 16064414aac4f84b48c52066d10c9e593948c4c1 [file] [log] [blame]
// Copyright (c) 2019, 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.
// SharedOptions=--enable-experiment=non-nullable
// Test that `x ?? y` results in type LUB(x!, y)
void main() {
f1(null, 2);
}
void f1(
int? nullableInt,
int nonNullInt,
) {
(nullableInt ?? nonNullInt) + 1; //# 00: ok
(nullableInt ?? nullableInt) + 1; //# 01: compile-time error
(nonNullInt ?? nullableInt) + 1; //# 02: compile-time error
(nonNullInt ?? nonNullInt) + 1; //# 03: ok
}
// TODO(mfairhurst) add cases with type parameter types