mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:39:48 +00:00
Add tests for noSuchMethod forwarders
Change-Id: I22cf843faf886ae877b351017a7a8e5ab25f7f0a Reviewed-on: https://dart-review.googlesource.com/47881 Reviewed-by: Peter von der Ahé <ahe@google.com> Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
This commit is contained in:
parent
c930c2bb72
commit
dacf9d4e18
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) 2018, 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.
|
||||
|
||||
// This test checks that a noSuchMethod forwarder is generated in classes that
|
||||
// inherit a user-defined noSuchMethod from their superclass and have not
|
||||
// implemented abstract methods from their interfaces.
|
||||
|
||||
class A {
|
||||
dynamic noSuchMethod(Invocation i) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class I {
|
||||
void foo();
|
||||
}
|
||||
|
||||
class B extends A implements I {}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,25 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → void;
|
||||
}
|
||||
class B extends self::A implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super self::A::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,25 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → void;
|
||||
}
|
||||
class B extends self::A implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super self::A::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,22 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
;
|
||||
}
|
||||
abstract class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
abstract method foo() → void;
|
||||
}
|
||||
class B extends self::A implements self::I {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,25 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → void;
|
||||
}
|
||||
class B extends self::A implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super self::A::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,25 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → void;
|
||||
}
|
||||
class B extends self::A implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super self::A::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) 2018, 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.
|
||||
|
||||
// This method checks that the noSuchMethod forwarder is generated in cases when
|
||||
// the class of the implemented interface has concrete methods.
|
||||
|
||||
class A {
|
||||
dynamic noSuchMethod(Invocation i) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class I {
|
||||
// This method is concrete.
|
||||
void foo() {}
|
||||
}
|
||||
|
||||
class B extends A implements I {}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,25 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method foo() → void {}
|
||||
}
|
||||
class B extends self::A implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super self::A::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,25 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method foo() → void {}
|
||||
}
|
||||
class B extends self::A implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super self::A::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,23 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
;
|
||||
}
|
||||
class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
method foo() → void
|
||||
;
|
||||
}
|
||||
class B extends self::A implements self::I {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,25 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method foo() → void {}
|
||||
}
|
||||
class B extends self::A implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super self::A::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,25 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method foo() → void {}
|
||||
}
|
||||
class B extends self::A implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super self::A::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (c) 2018, 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.
|
||||
|
||||
// This test checks that if an interface have a user-defined noSuchMethod, its
|
||||
// implementations that have their own user-defined noSuchMethods still receive
|
||||
// the noSuchMethod forwarders for each not implemented method from the
|
||||
// interface.
|
||||
|
||||
class I {
|
||||
dynamic noSuchMethod(Invocation i) => null;
|
||||
|
||||
// This should be a noSuchMethod forwarder, because [I] has a user-defined
|
||||
// [noSuchMethod].
|
||||
void foo();
|
||||
}
|
||||
|
||||
class M {
|
||||
dynamic noSuchMethod(Invocation i) => null;
|
||||
}
|
||||
|
||||
class A extends Object with M implements I {}
|
||||
|
||||
class B extends Object with M implements I {}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,36 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
}
|
||||
abstract class _A&Object&M = core::Object with self::M {
|
||||
}
|
||||
class A extends self::_A&Object&M implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
abstract class _B&Object&M = core::Object with self::M {
|
||||
}
|
||||
class B extends self::_B&Object&M implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,46 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
}
|
||||
abstract class _A&Object&M extends core::Object implements self::M {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
}
|
||||
class A extends self::_A&Object&M implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
abstract class _B&Object&M extends core::Object implements self::M {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
}
|
||||
class B extends self::_B&Object&M implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,33 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
;
|
||||
}
|
||||
abstract class _A&Object&M = core::Object with self::M {
|
||||
}
|
||||
class A extends self::_A&Object&M implements self::I {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
abstract class _B&Object&M = core::Object with self::M {
|
||||
}
|
||||
class B extends self::_B&Object&M implements self::I {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,36 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
}
|
||||
abstract class _A&Object&M = core::Object with self::M {
|
||||
}
|
||||
class A extends self::_A&Object&M implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
abstract class _B&Object&M = core::Object with self::M {
|
||||
}
|
||||
class B extends self::_B&Object&M implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,46 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
}
|
||||
abstract class _A&Object&M extends core::Object implements self::M {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
}
|
||||
class A extends self::_A&Object&M implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
abstract class _B&Object&M extends core::Object implements self::M {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
}
|
||||
class B extends self::_B&Object&M implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (c) 2018, 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.
|
||||
|
||||
// This test checks that the noSuchMethod forwarder is not duplicated in classes
|
||||
// that mix in the classes that already have the forwarder.
|
||||
|
||||
abstract class I {
|
||||
void foo();
|
||||
}
|
||||
|
||||
class A implements I {
|
||||
dynamic noSuchMethod(Invocation i) => null;
|
||||
}
|
||||
|
||||
class B extends Object with A {}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,26 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
abstract class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → void;
|
||||
}
|
||||
class A extends core::Object implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
abstract class _B&Object&A = core::Object with self::A {
|
||||
}
|
||||
class B extends self::_B&Object&A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,32 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
abstract class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → void;
|
||||
}
|
||||
class A extends core::Object implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
abstract class _B&Object&A extends core::Object implements self::A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
class B extends self::_B&Object&A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,24 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
abstract class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
abstract method foo() → void;
|
||||
}
|
||||
class A extends core::Object implements self::I {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
abstract class _B&Object&A = core::Object with self::A {
|
||||
}
|
||||
class B extends self::_B&Object&A {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,26 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
abstract class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → void;
|
||||
}
|
||||
class A extends core::Object implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
abstract class _B&Object&A = core::Object with self::A {
|
||||
}
|
||||
class B extends self::_B&Object&A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,32 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
abstract class I extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → void;
|
||||
}
|
||||
class A extends core::Object implements self::I {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
abstract class _B&Object&A extends core::Object implements self::A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
return null;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
class B extends self::_B&Object&A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (c) 2018, 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.
|
||||
|
||||
// This test checks that the noSuchMethod forwarder is generated in cases when
|
||||
// the user-defined noSuchMethod is inherited by classes with abstract methods.
|
||||
|
||||
class M {
|
||||
dynamic noSuchMethod(Invocation invocation) => null;
|
||||
}
|
||||
|
||||
class A extends M {
|
||||
void call(String s);
|
||||
}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,18 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation invocation) → dynamic
|
||||
return null;
|
||||
}
|
||||
class A extends self::M {
|
||||
synthetic constructor •() → void
|
||||
: super self::M::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method call(core::String s) → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,18 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation invocation) → dynamic
|
||||
return null;
|
||||
}
|
||||
class A extends self::M {
|
||||
synthetic constructor •() → void
|
||||
: super self::M::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method call(core::String s) → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,17 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
method noSuchMethod(core::Invocation invocation) → dynamic
|
||||
;
|
||||
}
|
||||
class A extends self::M {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
abstract no-such-method-forwarder method call(core::String s) → void;
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,18 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation invocation) → dynamic
|
||||
return null;
|
||||
}
|
||||
class A extends self::M {
|
||||
synthetic constructor •() → void
|
||||
: super self::M::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method call(core::String s) → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,18 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation invocation) → dynamic
|
||||
return null;
|
||||
}
|
||||
class A extends self::M {
|
||||
synthetic constructor •() → void
|
||||
: super self::M::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method call(core::String s) → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (c) 2018, 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.
|
||||
|
||||
// This test checks that the noSuchMethod forwarder is generated in cases when
|
||||
// the user-defined noSuchMethod is mixed in to a class with abstract methods.
|
||||
|
||||
class A {
|
||||
dynamic noSuchMethod(Invocation i) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class B extends Object with A {
|
||||
void foo();
|
||||
}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,21 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class _B&Object&A = core::Object with self::A {
|
||||
}
|
||||
class B extends self::_B&Object&A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,27 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class _B&Object&A extends core::Object implements self::A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
class B extends self::_B&Object&A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,19 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
;
|
||||
}
|
||||
abstract class _B&Object&A = core::Object with self::A {
|
||||
}
|
||||
class B extends self::_B&Object&A {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,21 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class _B&Object&A = core::Object with self::A {
|
||||
}
|
||||
class B extends self::_B&Object&A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,27 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class _B&Object&A extends core::Object implements self::A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
class B extends self::_B&Object&A {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
17
pkg/front_end/testcases/no_such_method_forwarders/same.dart
Normal file
17
pkg/front_end/testcases/no_such_method_forwarders/same.dart
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Copyright (c) 2018, 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.
|
||||
|
||||
// This test checks that a noSuchMethod forwarder is generated in the case when
|
||||
// the user-defined noSuchMethod and the abstract method are both defined in the
|
||||
// same class.
|
||||
|
||||
class A {
|
||||
dynamic noSuchMethod(Invocation i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
void foo();
|
||||
}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,14 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,14 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,13 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,14 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,14 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class A extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
abstract no-such-method-forwarder method foo() → void;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) 2018, 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.
|
||||
|
||||
// This test checks that the generated noSuchMethod forwarder for a
|
||||
// non-implemented abstract method has all the references to the type variables
|
||||
// in its signature replaced with the appropriate types.
|
||||
|
||||
class I<T> {
|
||||
T foo();
|
||||
}
|
||||
|
||||
class M {
|
||||
dynamic noSuchMethod(Invocation i) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class A extends Object with M implements I<int> {}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,27 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I<T extends core::Object> extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → self::I::T;
|
||||
}
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class _A&Object&M = core::Object with self::M {
|
||||
}
|
||||
class A extends self::_A&Object&M implements self::I<core::int> {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → core::int;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,33 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I<T extends core::Object> extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → self::I::T;
|
||||
}
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class _A&Object&M extends core::Object implements self::M {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
class A extends self::_A&Object&M implements self::I<core::int> {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → core::int;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,24 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I<T extends core::Object> extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
abstract method foo() → self::I::T;
|
||||
}
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic
|
||||
;
|
||||
}
|
||||
abstract class _A&Object&M = core::Object with self::M {
|
||||
}
|
||||
class A extends self::_A&Object&M implements self::I<core::int> {
|
||||
synthetic constructor •() → void
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → core::int;
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,27 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I<T extends core::Object> extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → self::I::T;
|
||||
}
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class _A&Object&M = core::Object with self::M {
|
||||
}
|
||||
class A extends self::_A&Object&M implements self::I<core::int> {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → core::int;
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,33 @@
|
|||
library;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class I<T extends core::Object> extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract method foo() → self::I::T;
|
||||
}
|
||||
class M extends core::Object {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
abstract class _A&Object&M extends core::Object implements self::M {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
method noSuchMethod(core::Invocation i) → dynamic {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
class A extends self::_A&Object&M implements self::I<core::int> {
|
||||
synthetic constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract no-such-method-forwarder method foo() → core::int;
|
||||
}
|
||||
static method main() → dynamic {}
|
Loading…
Reference in a new issue