Skip to content

Instantly share code, notes, and snippets.

@floitschG
Last active October 5, 2015 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floitschG/19b40eb6216b72f3a2b2 to your computer and use it in GitHub Desktop.
Save floitschG/19b40eb6216b72f3a2b2 to your computer and use it in GitHub Desktop.
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