blob: 95c7e6b93e8d0bd78b92dd7134cad1a95bf73e25 [file] [log] [blame]
// Copyright (c) 2013, 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.
// Test that final fields in @MirrorsUsed are still inferred.
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import 'memory_compiler.dart' show compilerFor;
import 'compiler_helper.dart' show findElement;
const MEMORY_SOURCE_FILES = const <String, String> {
'main.dart': """
import 'dart:mirrors';
const field = 42;
main() {
var mirror = reflect(field);
mirror.invoke(null, null);
}
"""
};
void main() {
var compiler = compilerFor(MEMORY_SOURCE_FILES);
asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) {
var element = findElement(compiler, 'field');
var typesTask = compiler.typesTask;
var typesInferrer = typesTask.typesInferrer;
Expect.equals(typesTask.uint31Type,
typesInferrer.getTypeOfElement(element).simplify(compiler),
'field');
}));
}