Files
sdk/pkg/front_end/testcases/constructor_const_inference.dart
T
Dmitry Stefantsov 0277432f28 [fasta] Fix inference for const redirecting factories invocations
Fixes #33813.

Bug: http://dartbug.com/33813
Change-Id: I53708666f6c5d55760a8bc23f042565ba073812f
Reviewed-on: https://dart-review.googlesource.com/64841
Reviewed-by: Jens Johansen <jensj@google.com>
2018-07-16 11:24:36 +00:00

29 lines
722 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.
// This test checks that the type inference implementation correctly uses least
// closure of the inferred type arguments in invocations of 'const' constructors
// in case there are type variables in them.
class _Y<T> {
const _Y();
}
class A<T> {
_Y<T> x;
A(this.x);
}
class B<T> extends A<T> {
B() : super(const _Y());
}
main() {
dynamic x = new B().x;
if (x is! _Y<Null>) {
throw "Unexpected run-time type: `new B().x` is ${x.runtimeType}, "
"but `_Y<Null>` expected";
}
}