blob: fb9cc65c88dd4c33e2d1998ca36d7b76dc9fd756 [file] [log] [blame]
// Copyright (c) 2019, 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.
extension Extension on String {
int get noSuchMethod => 42;
void set hashCode(int value) {}
int runtimeType() => 0;
operator ==(other) => false;
static String toString() => 'Foo';
}
main() {
int value;
expect(true, "".noSuchMethod is Function);
value = Extension("").noSuchMethod;
Extension("").hashCode = 42;
expect(true, "".runtimeType is Type);
expect(true, Extension("").runtimeType is Function);
value = Extension("").runtimeType();
expect(true, "" == "");
expect('Foo', Extension.toString());
}
errors() {
int value;
value = "".noSuchMethod;
"".hashCode = 42;
value = "".runtimeType;
}
expect(expected, actual) {
if (expected != actual) {
throw 'Mismatch: expected=$expected, actual=$actual';
}
}