Chromium Code Reviews| Index: tests/compiler/dart2js/type_inference8_test.dart |
| diff --git a/tests/compiler/dart2js/type_inference6_test.dart b/tests/compiler/dart2js/type_inference8_test.dart |
| similarity index 58% |
| copy from tests/compiler/dart2js/type_inference6_test.dart |
| copy to tests/compiler/dart2js/type_inference8_test.dart |
| index d0da1e7cb038a3fde27c8d4ea487f3116e6bbfee..70592edf2da99f4d5fb882be46c822f9779230fb 100644 |
| --- a/tests/compiler/dart2js/type_inference6_test.dart |
| +++ b/tests/compiler/dart2js/type_inference8_test.dart |
| @@ -1,8 +1,9 @@ |
| -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| +// Copyright (c) 2015, 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:async_helper/async_helper.dart"; |
| +import "package:compiler/src/types/types.dart"; |
| import "package:expect/expect.dart"; |
| import 'compiler_helper.dart'; |
| import 'type_mask_test_helper.dart'; |
| @@ -10,13 +11,21 @@ import 'type_mask_test_helper.dart'; |
| import 'dart:async'; |
| const String TEST = r""" |
|
herhut
2015/09/28 23:55:30
Can you also add a test where it is supposed to fa
Siggi Cherem (dart-lang)
2015/09/29 00:08:33
+1 :)
Harry Terkelsen
2015/09/29 00:42:54
Done.
|
| -foo() { |
| - var a = [1, 2, 3]; |
| - return a.first; |
| +foo(x) { |
|
Siggi Cherem (dart-lang)
2015/09/29 00:08:33
would this work if we make foo non-inlinable?
Harry Terkelsen
2015/09/29 00:42:54
the compiler returned by compilerFor from compiler
|
| + return x; |
| +} |
| + |
| +bar(x) { |
| + if (x) { |
| + print("aaa"); |
| + } else { |
| + print("bbb"); |
| + } |
| } |
| main() { |
| - foo(); |
| + bar(foo(false)); |
| + bar(foo(foo(false))); |
| } |
| """; |
| @@ -28,8 +37,14 @@ Future runTest() { |
| var typesInferrer = typesTask.typesInferrer; |
| var element = findElement(compiler, "foo"); |
| var mask = typesInferrer.getReturnTypeOfElement(element); |
| - Expect.equals(typesTask.uint31Type, simplify(mask, compiler)); |
| - }); |
| + var falseType = new ValueTypeMask(typesTask.boolType, false); |
| + // 'foo' should always return false |
| + Expect.equals(falseType, mask); |
| + // the argument to 'bar' is always false |
| + var barArg = element.parameters.first; |
| + var barArgMask = typesInferrer.getTypeOfElement(barArg); |
| + Expect.equals(falseType, barArgMask); |
| + }).then((_) => compileAndDoNotMatchFuzzy(TEST, 'main', r'\"aaa\"')); |
| } |
| main() { |