mirror of
https://github.com/dart-lang/sdk
synced 2024-09-20 05:51:37 +00:00
5b6c0ba820
Review URL: https://codereview.chromium.org//14049009 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21465 260f80e4-7a28-3924-810f-c04153c831b5
34 lines
1 KiB
Dart
34 lines
1 KiB
Dart
// 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.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
// Regression test for https://code.google.com/p/dart/issues/detail?id=7697.
|
|
// dart2js used to optimize [noSuchMethod] based on the user-provided
|
|
// argument, and forget that the runtime might call it with its own
|
|
// [Invocation] implementation.
|
|
|
|
class Hey {
|
|
foo() => noSuchMethod(new FakeInvocationMirror());
|
|
noSuchMethod(x) => x;
|
|
}
|
|
|
|
class You extends Hey {
|
|
// We used to think this method is always called with a
|
|
// FakeInvocationMirror instance, but it's also called with the
|
|
// internal mirror implementation.
|
|
noSuchMethod(x) => x.isGetter;
|
|
}
|
|
|
|
class FakeInvocationMirror implements Invocation {
|
|
final bool isGetter = false;
|
|
}
|
|
|
|
main() {
|
|
var x = new Hey();
|
|
Expect.isTrue(x.foo() is FakeInvocationMirror);
|
|
var y = [new You()];
|
|
Expect.isTrue(y[0].bar);
|
|
}
|