blob: 55715f87ebe2f34d1bf8f2e27214358f2b92a1a5 [file] [log] [blame]
library;
//
// Problems in library:
//
// pkg/front_end/testcases/extensions/conflict_with_object.dart:6:11: Error: This extension member conflicts with Object member 'noSuchMethod'.
// int get noSuchMethod => 42;
// ^^^^^^^^^^^^
//
// pkg/front_end/testcases/extensions/conflict_with_object.dart:8:7: Error: This extension member conflicts with Object member 'runtimeType'.
// int runtimeType() {}
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/extensions/conflict_with_object.dart:9:12: Error: This extension member conflicts with Object member '=='.
// operator ==(other) => false;
// ^^
//
// pkg/front_end/testcases/extensions/conflict_with_object.dart:10:17: Error: This extension member conflicts with Object member 'toString'.
// static String toString() => 'Foo';
// ^^^^^^^^
//
// pkg/front_end/testcases/extensions/conflict_with_object.dart:7:12: Error: This extension member conflicts with Object member 'hashCode'.
// void set hashCode(int value) {}
// ^^^^^^^^
//
// pkg/front_end/testcases/extensions/conflict_with_object.dart:27:14: Error: A value of type 'dynamic Function(Invocation)' can't be assigned to a variable of type 'int'.
// - 'Invocation' is from 'dart:core'.
// value = "".noSuchMethod;
// ^
//
// pkg/front_end/testcases/extensions/conflict_with_object.dart:28:6: Error: The setter 'hashCode' isn't defined for the class 'String'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named 'hashCode'.
// "".hashCode = 42;
// ^^^^^^^^
//
// pkg/front_end/testcases/extensions/conflict_with_object.dart:29:14: Error: A value of type 'Type' can't be assigned to a variable of type 'int'.
// - 'Type' is from 'dart:core'.
// value = "".runtimeType;
// ^
//
import self as self;
import "dart:core" as core;
extension Extension on core::String* {
get noSuchMethod = self::Extension|get#noSuchMethod;
method runtimeType = self::Extension|runtimeType;
tearoff runtimeType = self::Extension|get#runtimeType;
operator == = self::Extension|==;
static method toString = self::Extension|toString;
set hashCode = self::Extension|set#hashCode;
}
static method Extension|get#noSuchMethod(final core::String* #this) → core::int*
return 42;
static method Extension|set#hashCode(final core::String* #this, core::int* value) → void {}
static method Extension|runtimeType(final core::String* #this) → core::int* {}
static method Extension|get#runtimeType(final core::String* #this) → () →* core::int*
return () core::int* => self::Extension|runtimeType(#this);
static method Extension|==(final core::String* #this, dynamic other) → dynamic
return false;
static method Extension|toString() core::String*
return "Foo";
static method main() dynamic {
core::int* value;
self::expect(true, "".{core::Object::noSuchMethod} is core::Function*);
value = self::Extension|get#noSuchMethod("");
self::Extension|set#hashCode("", 42);
self::expect(true, "".{core::Object::runtimeType} is core::Type*);
self::expect(true, self::Extension|get#runtimeType("") is core::Function*);
value = self::Extension|runtimeType("");
self::expect(true, "".{core::String::==}(""));
self::expect("Foo", self::Extension|toString());
}
static method errors() dynamic {
core::int* value;
value = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/extensions/conflict_with_object.dart:27:14: Error: A value of type 'dynamic Function(Invocation)' can't be assigned to a variable of type 'int'.
- 'Invocation' is from 'dart:core'.
value = \"\".noSuchMethod;
^" in "".{core::Object::noSuchMethod} as{TypeError} core::int*;
invalid-expression "pkg/front_end/testcases/extensions/conflict_with_object.dart:28:6: Error: The setter 'hashCode' isn't defined for the class 'String'.
Try correcting the name to the name of an existing setter, or defining a setter or field named 'hashCode'.
\"\".hashCode = 42;
^^^^^^^^";
value = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/extensions/conflict_with_object.dart:29:14: Error: A value of type 'Type' can't be assigned to a variable of type 'int'.
- 'Type' is from 'dart:core'.
value = \"\".runtimeType;
^" in "".{core::Object::runtimeType} as{TypeError} core::int*;
}
static method expect(dynamic expected, dynamic actual) → dynamic {
if(!expected.{core::Object::==}(actual)) {
throw "Mismatch: expected=${expected}, actual=${actual}";
}
}
Extra constant evaluation status:
Evaluated: MethodInvocation @ org-dartlang-testcase:///conflict_with_object.dart:21:19 -> BoolConstant(true)
Extra constant evaluation: evaluated: 37, effectively constant: 1