Files
sdk/pkg/front_end/testcases/inference/bug32291.dart
T
Paul Berry 90098c6c49 In front_end, treat ? and _ type contexts as equivalent.
We do this by requiring that the context argument to inferExpression
is non-null (since `_` is represented by `null`).  Instead of passing
`null` as a type context, we pass `const UnknownType()`, which
represents `?`.

See #32291.

Change-Id: I9a0d0f3bcd74e6226004c85f63cf8be49934388a
Reviewed-on: https://dart-review.googlesource.com/43761
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-03-01 13:20:28 +00:00

22 lines
827 B
Dart

// Copyright (c) 2018, 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.
/*@testedFeatures=inference*/
library test;
void main() {
var /*@type=List<List<String>>*/ l = /*@typeArgs=List<String>*/ [
/*@typeArgs=String*/ ["hi", "world"]
];
var /*@type=Iterable<List<String>>*/ i1 =
l. /*@target=Iterable::map*/ /*@typeArgs=List<String>*/ map(
/*@returnType=List<String>*/ (/*@type=List<String>*/ ll) =>
ll ?? /*@typeArgs=String*/ []);
var /*@type=Iterable<int>*/ i2 =
i1. /*@target=Iterable::map*/ /*@typeArgs=int*/ map(
/*@returnType=int*/ (List<String> l) =>
l. /*@target=List::length*/ length);
print(i2);
}