Skip to content

Commit

Permalink
Migrate language_2/abstract to NNBD.
Browse files Browse the repository at this point in the history
Change-Id: I265933f36f68df6f8e542a3f85ce0b04e1dfd549
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134205
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
  • Loading branch information
munificent authored and commit-bot@chromium.org committed Feb 4, 2020
1 parent 1d932f7 commit 68e904e
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/language/abstract/exact_selector_runtime_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// TODO(multitest): This was automatically migrated from a multitest and may
// contain strange or dead code.

// Copyright (c) 2013, 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.

// Regression test for dart2js that used to duplicate some `Object`
// methods to handle `noSuchMethod`.

import "package:expect/expect.dart";
import "../compiler_annotations.dart";

class Foo {
noSuchMethod(im) => 42;
}

@DontInline()
returnFoo() {
(() => 42)();
return new Foo();
}

class Bar {
operator ==(other) => false;
}

var a = [false, true, new Object(), new Bar()];

main() {
if (a[0] as bool) {
// This `==` call will make the compiler create a selector with an
// exact `TypeMask` of `Foo`. Since `Foo` is abstract, such a call
// cannot happen, but we still used to generate a `==` method on
// the `Object` class to handle `noSuchMethod`.
print(returnFoo() == 42);
} else {
Expect.isFalse(a[2] == 42);
}
}
34 changes: 34 additions & 0 deletions tests/language/abstract/factory_constructor_runtime_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// TODO(multitest): This was automatically migrated from a multitest and may
// contain strange or dead code.

// 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 constructors and initializers.

// Exercises issue 2282, factory constructors in abstract classes should
// not emit a static type warning

class B extends A1 {
B() {}
method() {}
}

abstract class A1 {
A1() {}
method(); // Abstract.
factory A1.make() {
return new B();
}
}

class A2 {
// Intentionally abstract method.

A2.make() {}
}

main() {
new A1.make();

}
23 changes: 23 additions & 0 deletions tests/language/abstract/syntax_runtime_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// TODO(multitest): This was automatically migrated from a multitest and may
// contain strange or dead code.

// 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.

import "package:expect/expect.dart";

main() {
var b = new B();
Expect.equals(42, b.foo());
}

class A {


}

class B extends A {
foo() => 42;
bar() => 87;
}

0 comments on commit 68e904e

Please sign in to comment.