Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1010)

Unified Diff: pkg/analyzer/test/generated/non_error_resolver_test.dart

Issue 1539623002: Compute values of elements a unit constant expressions depend on. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/tool/task_dependency_graph/tasks.dot » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/non_error_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index 8ffd39abd0d1806df22387c6591a2093b677b3ac..cadb94a847a3736aa4f1df79b0a69dea5110e698 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -1652,21 +1652,21 @@ export 'lib1.dart';''');
verify([source]);
}
- void test_extraPositionalArguments_Function() {
+ void test_extraPositionalArguments_function() {
Source source = addSource(r'''
-f(Function a) {
- a(1, 2);
+f(p1, p2) {}
+main() {
+ f(1, 2);
}''');
computeLibrarySourceErrors(source);
assertNoErrors(source);
verify([source]);
}
- void test_extraPositionalArguments_function() {
+ void test_extraPositionalArguments_Function() {
Source source = addSource(r'''
-f(p1, p2) {}
-main() {
- f(1, 2);
+f(Function a) {
+ a(1, 2);
}''');
computeLibrarySourceErrors(source);
assertNoErrors(source);
@@ -3977,7 +3977,23 @@ class B extends A {
verify([source]);
}
- void test_nonConstCaseExpression() {
+ void test_nonConstCaseExpression_constField() {
+ Source source = addSource(r'''
+f(double p) {
+ switch (p) {
+ case double.INFINITY:
+ return true;
+ default:
+ return false;
+ }
+}''');
+ computeLibrarySourceErrors(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
+ verify([source]);
+ }
+
+ void test_nonConstCaseExpression_typeLiteral() {
Source source = addSource(r'''
f(Type t) {
switch (t) {
@@ -3993,6 +4009,16 @@ f(Type t) {
verify([source]);
}
+ void test_nonConstListElement_constField() {
+ Source source = addSource(r'''
+main() {
+ const [double.INFINITY];
+}''');
+ computeLibrarySourceErrors(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_nonConstMapAsExpressionStatement_const() {
Source source = addSource(r'''
f() {
@@ -4023,6 +4049,27 @@ f() {
verify([source]);
}
+ void test_nonConstMapKey_constField() {
+ Source source = addSource(r'''
+main() {
+ const {double.INFINITY: 0};
+}''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source,
+ [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
+ verify([source]);
+ }
+
+ void test_nonConstMapValue_constField() {
+ Source source = addSource(r'''
+main() {
+ const {0: double.INFINITY};
+}''');
+ computeLibrarySourceErrors(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_nonConstValueInInitializer_binary_bool() {
Source source = addSource(r'''
class A {
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/tool/task_dependency_graph/tasks.dot » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698