Files
sdk/pkg/analyzer/test/generated/issues_test.dart
T
Konstantin Shcheglov c2379a800a Move more tests to PubPackageResolutionTest.
R=brianwilkerson@google.com

Change-Id: Ic6c37d069323cc06c6ab630757625a7e0b072200
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-06 22:30:39 +00:00

54 lines
1.3 KiB
Dart

// 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.
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../src/dart/resolution/context_collection_resolution.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(IssuesTest);
});
}
/// Tests for various end-to-end cases reported as user issues, where it is
/// not obvious where to put the test otherwise.
@reflectiveTest
class IssuesTest extends PubPackageResolutionTest {
/// https://github.com/dart-lang/sdk/issues/38565
///
/// The issue was that type inference for annotation instantiation
/// was done incorrectly, without resolving arguments to the annotation
/// constructor. So, we were trying to perform type inference using null
/// types of arguments.
test_issue38565() async {
await resolveTestCode('''
class A<T> {
const A(int a);
}
class C {
@A(0)
int field;
}
''');
// Should not crash.
}
/// https://github.com/dart-lang/sdk/issues/38589
test_issue38589() async {
await resolveTestCode('''
mixin M {}
class A implements M {}
class B implements M {}
var b = true;
var c = b ? A() : B();
''');
assertType(findElement.topVar('c').type, 'M');
}
}