blob: 4be1c2fcb5b69762f672011bd11f8ff4438984f5 [file] [log] [blame]
// Copyright (c) 2023, 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/diagnostic/diagnostic.dart' as diag;
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/context_collection_resolution.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ConstEvalMethodInvocationTest);
});
}
@reflectiveTest
class ConstEvalMethodInvocationTest extends PubPackageResolutionTest {
test_function() async {
await assertErrorsInCode(
'''
int f() {
return 3;
}
const a = f();
''',
[error(diag.constEvalMethodInvocation, 34, 3)],
);
}
test_identical() async {
await assertNoErrorsInCode('''
const a = identical(1, 1);
''');
}
}