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

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

Issue 2043173002: Fix LUB computation in face of errors in code (issue 26631) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months 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/generated/static_type_analyzer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/static_type_analyzer_test.dart
diff --git a/pkg/analyzer/test/generated/static_type_analyzer_test.dart b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
index a8f91050804257832491a420ba8a237d773f04c3..af3ae5053517efa3d5c958bb9ae8ceaa7e0494fc 100644
--- a/pkg/analyzer/test/generated/static_type_analyzer_test.dart
+++ b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
@@ -1078,6 +1078,29 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
_listener.assertNoErrors();
}
+ void test_visitListLiteral_unresolved() {
+ _analyzer = _createAnalyzer(strongMode: true);
+ // [a] // where 'a' is not resolved
+ Identifier identifier = AstFactory.identifier3('a');
+ Expression node = AstFactory.listLiteral([identifier]);
+ DartType resultType = _analyze(node);
+ expect(resultType, isNull);
+ _listener.assertNoErrors();
+ }
+
+ void test_visitListLiteral_unresolved_multiple() {
+ _analyzer = _createAnalyzer(strongMode: true);
+ // [0, a, 1] // where 'a' is not resolved
+ Identifier identifier = AstFactory.identifier3('a');
+ Expression node = AstFactory.listLiteral([_resolvedInteger(0), identifier, _resolvedInteger(1)]);
+ DartType resultType = _analyze(node);
+ _assertType2(
+ _typeProvider.listType
+ .instantiate(<DartType>[_typeProvider.intType]),
+ resultType);
+ _listener.assertNoErrors();
+ }
+
void test_visitMapLiteral_empty() {
// {}
Expression node = AstFactory.mapLiteral2();
@@ -1488,11 +1511,16 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
/**
* Create the analyzer used by the tests.
- *
- * @return the analyzer to be used by the tests
*/
- StaticTypeAnalyzer _createAnalyzer() {
- InternalAnalysisContext context = AnalysisContextFactory.contextWithCore();
+ StaticTypeAnalyzer _createAnalyzer({bool strongMode: false}) {
+ InternalAnalysisContext context;
+ if (strongMode) {
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.strongMode = true;
+ context = AnalysisContextFactory.contextWithCoreAndOptions(options);
+ } else {
+ context = AnalysisContextFactory.contextWithCore();
+ }
FileBasedSource source =
new FileBasedSource(FileUtilities2.createFile("/lib.dart"));
CompilationUnitElementImpl definingCompilationUnit =
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698