blob: 71eb8e171c2c3072a97fe758e704b5d466971b19 [file] [log] [blame]
// Copyright (c) 2020, 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:analyzer/src/error/codes.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/context_collection_resolution.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(BuiltInIdentifierAsTypeNameTest);
});
}
@reflectiveTest
class BuiltInIdentifierAsTypeNameTest extends PubPackageResolutionTest {
test_class() async {
await assertErrorsInCode('''
class as {}
''', [
error(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME, 6, 2),
]);
}
test_enum() async {
await assertErrorsInCode('''
enum as {
v
}
''', [
error(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME, 5, 2),
]);
}
test_mixin() async {
await assertErrorsInCode('''
mixin as {}
''', [
error(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME, 6, 2),
]);
}
test_mixin_OK_on() async {
await assertNoErrorsInCode(r'''
class A {}
mixin on on A {}
mixin M on on {}
mixin M2 implements on {}
class B = A with on;
class C = B with M;
class D = Object with M2;
''');
}
}