| Index: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
|
| diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
|
| index ecba99e4c65c4699c5c23d0678f24f245fad5ab3..cc2c2c582c912fe863420b1bda6b8a38ac2fda6d 100644
|
| --- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
|
| +++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
|
| @@ -1584,6 +1584,34 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
|
| verify(source);
|
| }
|
|
|
| + public void test_fromEnvironment_bool_badArgs() throws Exception {
|
| + Source source = addSource(createSource(//
|
| + "var b1 = const bool.fromEnvironment(1);",
|
| + "var b2 = const bool.fromEnvironment('x', defaultValue: 1);"));
|
| + resolve(source);
|
| + assertErrors(
|
| + source,
|
| + CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| + StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
|
| + CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| + StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
|
| + verify(source);
|
| + }
|
| +
|
| + public void test_fromEnvironment_bool_badDefault_whenDefined() throws Exception {
|
| + // The type of the defaultValue needs to be correct even when the default value
|
| + // isn't used (because the variable is defined in the environment).
|
| + analysisContext.getDeclaredVariables().define("x", "true");
|
| + Source source = addSource(createSource(//
|
| + "var b = const bool.fromEnvironment('x', defaultValue: 1);"));
|
| + resolve(source);
|
| + assertErrors(
|
| + source,
|
| + CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
|
| + StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
|
| + verify(source);
|
| + }
|
| +
|
| public void test_getterAndMethodWithSameName() throws Exception {
|
| Source source = addSource(createSource(//
|
| "class A {",
|
|
|