Throw a type error in production mode when the type of the type test is not
declared (issue 2571). Add test. Delete bad negative test now covered by new test. Update status files of different compilers. Review URL: https://chromiumcodereview.appspot.com//10035058 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6754 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -205,7 +205,7 @@ Language/08_Interfaces/3_Factories_and_Constructors_A06_t07: Fail
|
||||
Language/08_Interfaces/3_Factories_and_Constructors_A06_t08: Fail
|
||||
Language/08_Interfaces/4_Superinterfaces/1_Inheritance_and_Overriding_A01_t02: Fail
|
||||
Language/08_Interfaces/4_Superinterfaces_A01_t02: Fail
|
||||
Language/09_Generics/09_Generics_A04_t06: Fail
|
||||
Language/09_Generics/09_Generics_A04_t06: Fail # Issue 439
|
||||
LibTest/core/FallThroughError/FallThroughError_A01_t01: Fail
|
||||
LibTest/core/FallThroughError/toString_A01_t01: Fail
|
||||
LibTest/core/Match/group_A01_t01: Fail # co19 issue 92
|
||||
@@ -235,7 +235,7 @@ Language/11_Statements/11_Labels_A01_t03: Fail # TODO(vm-team): New failure at r
|
||||
Language/12_Libraries_and_Scripts/1_Imports_A05_t01: Fail # TODO(vm-team): New failure at r164. Please triage.
|
||||
|
||||
[ $runtime == vm && $unchecked ]
|
||||
Language/03_Overview/2_Privacy_A01_t06: Fail # TODO(vm-team): New failure at r164. Please triage.
|
||||
Language/09_Generics/09_Generics_A04_t04: Fail # co19 issue 117
|
||||
|
||||
|
||||
[ $runtime == vm && $arch == ia32 ]
|
||||
|
||||
@@ -61,6 +61,7 @@ GenericDeepTest: Fail # Expect.isTrue(false) fails.
|
||||
GenericInheritanceTest: Fail # Expect.isTrue(false) fails.
|
||||
GenericParameterizedExtendsTest: Fail # Expect.isTrue(false) fails.
|
||||
Instanceof2Test: Fail # Expect.equals(expected: <true>, actual: <false>) fails.
|
||||
Instanceof3Test: Fail # cannot resolve type UndeclaredType.
|
||||
LibraryPrivateInConstructorTest: Fail # Issue 2620.
|
||||
ListDoubleIndexInLoop2Test: Fail # Issue 2564.
|
||||
ListLiteral4Test: Fail # Illegal argument(s): 0 -- checked mode test.
|
||||
|
||||
@@ -73,7 +73,6 @@ ConstructorRedirectTest/01: Fail # Issue 2103.
|
||||
|
||||
[ $compiler == none && $unchecked ]
|
||||
|
||||
IsNotClass3NegativeTest: Fail # Spec unclear.
|
||||
Prefix16NegativeTest: Fail # Bug 5532534
|
||||
|
||||
[ $compiler == none && $mode == debug ]
|
||||
@@ -108,6 +107,7 @@ FunctionTypeAliasNegativeTest: Fail # Bug 5231617.
|
||||
GenericParameterizedExtendsTest: Skip # Bug 5392297
|
||||
GettersSettersType3Test: Fail # Issue 2351
|
||||
InstanceCallWrongArgumentCountNegativeTest: Fail
|
||||
Instanceof3Test: Fail # Issue 2571
|
||||
Label2NegativeTest: Fail # issue 1658
|
||||
Library4NegativeTest: Fail # Bug 5406175
|
||||
ListLiteral4Test: Fail # Issue 1343
|
||||
@@ -308,6 +308,7 @@ GetterClosureExecutionOrderTest: Pass # TODO(jmesserly): I don't think this is r
|
||||
ImplicitScopeTest: Fail
|
||||
ImpliedInterfaceTest: Fail
|
||||
Instanceof2Test: Fail
|
||||
Instanceof3Test: Fail # Issue 2571
|
||||
InterfaceFactory3NegativeTest: Fail
|
||||
IsNotClass4NegativeTest: Fail
|
||||
LabelTest: Fail
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
// Dart test program for testing the instanceof operation.
|
||||
|
||||
// In the type test 'e is T', it is a run-time error if T does not denote a type
|
||||
// available in the current lexical scope.
|
||||
|
||||
isCheckedMode() {
|
||||
try {
|
||||
var i = 1;
|
||||
String s = i;
|
||||
return false;
|
||||
} catch(var e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
{
|
||||
bool got_type_error = false;
|
||||
var x = null;
|
||||
try {
|
||||
Expect.isFalse(x is UndeclaredType); // x is null.
|
||||
} catch (TypeError error) {
|
||||
got_type_error = true;
|
||||
}
|
||||
// Type error in production mode and in checked mode.
|
||||
Expect.isTrue(got_type_error);
|
||||
}
|
||||
{
|
||||
bool got_type_error = false;
|
||||
var x = 1;
|
||||
try {
|
||||
Expect.isFalse(x is UndeclaredType); // x is not null.
|
||||
} catch (TypeError error) {
|
||||
got_type_error = true;
|
||||
}
|
||||
// Type error in production mode and in checked mode.
|
||||
Expect.isTrue(got_type_error);
|
||||
}
|
||||
{
|
||||
bool got_type_error = false;
|
||||
var x = null;
|
||||
try {
|
||||
Expect.isFalse(x is List<UndeclaredType>); // x is null.
|
||||
} catch (TypeError error) {
|
||||
got_type_error = true;
|
||||
}
|
||||
// Type error in checked mode only.
|
||||
Expect.isTrue(got_type_error == isCheckedMode());
|
||||
}
|
||||
{
|
||||
bool got_type_error = false;
|
||||
var x = 1;
|
||||
try {
|
||||
Expect.isFalse(x is List<UndeclaredType>); // x is not a List.
|
||||
} catch (TypeError error) {
|
||||
got_type_error = true;
|
||||
}
|
||||
// Type error in checked mode only.
|
||||
Expect.isTrue(got_type_error == isCheckedMode());
|
||||
}
|
||||
{
|
||||
bool got_type_error = false;
|
||||
var x = new List();
|
||||
try {
|
||||
Expect.isTrue(x is List<UndeclaredType>); // x is a List<Dynamic>.
|
||||
} catch (TypeError error) {
|
||||
got_type_error = true;
|
||||
}
|
||||
// Type error in checked mode only.
|
||||
Expect.isTrue(got_type_error == isCheckedMode());
|
||||
}
|
||||
{
|
||||
bool got_type_error = false;
|
||||
var x = new List<int>();
|
||||
try {
|
||||
Expect.isTrue(x is List<UndeclaredType>); // x is a List<int>.
|
||||
} catch (TypeError error) {
|
||||
got_type_error = true;
|
||||
}
|
||||
// Type error in checked mode only.
|
||||
Expect.isTrue(got_type_error == isCheckedMode());
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// Copyright (c) 2011, 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.
|
||||
// Dart test program for catch that we expect a class after an 'is'.
|
||||
|
||||
class A {
|
||||
const A();
|
||||
}
|
||||
|
||||
class IsNotClass3NegativeTest {
|
||||
static testMain() {
|
||||
var a = new A();
|
||||
|
||||
if (a is B) {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
IsNotClass3NegativeTest.testMain();
|
||||
}
|
||||
Reference in New Issue
Block a user