Last active
October 5, 2015 19:10
-
-
Save floitschG/19b40eb6216b72f3a2b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A<T> { | |
final T x; | |
A(this.x); | |
} | |
// Currently an easy way to avoid inlining. | |
// This will change soon! | |
confuse(x) { | |
return x; | |
return x; | |
} | |
class B { | |
toString() => "B"; | |
} | |
main() { | |
A<int> aInt = confuse(new A<int>(499)); | |
A<B> aB = confuse(new A<B>(new B())); | |
print(aInt.x.toString()); | |
print(aB.x.toString()); | |
} | |
// Without and without trust-type-annotation: | |
// P.print(J.toString$0$(aInt.x)); | |
// P.print(J.toString$0$(aB.x)); | |
// Replacing main with this one: | |
main() { | |
A<int> aInt = confuse(new A<int>(499)); | |
A<B> aB = confuse(new A<B>(new B())); | |
int t1 = aInt.x; | |
B t2 = aB.x; | |
print(t1.toString()); | |
print(t2.toString()); | |
} | |
// Without --trust-type-annotations, as before. | |
// With --trust-type-annotations: | |
// P.print(C.JSInt_methods.toString$0(aInt.x)); | |
// P.print("B"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment