diff options
author | Martin Odersky <odersky@gmail.com> | 2014-03-30 10:49:42 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-03-31 14:52:08 +0200 |
commit | 9bd1e6a99e1cb09a3527e548699d1561e72e36d3 (patch) | |
tree | e9f3899d05cf3cb2012e3f3032f1a3fc4da52415 /tests/pos/unions.scala | |
parent | fc4648d33a051ff5d220c2fea097fc99b5883ecc (diff) | |
download | dotty-9bd1e6a99e1cb09a3527e548699d1561e72e36d3.tar.gz dotty-9bd1e6a99e1cb09a3527e548699d1561e72e36d3.tar.bz2 dotty-9bd1e6a99e1cb09a3527e548699d1561e72e36d3.zip |
More fixes and tests for easure.
1. Object_isInstanceOf/asInstanceOf are no longer parameterized methods (seems there's
no point in writing x.$asInstanceOf[T]() instead of the shorter x.$asInstanceOf[T]).
2. Array constructor's type is unchanged (the previous rules erased it to
def <init>(len: Int)Object
which is clearly wrong).
3. indexing needs to be disabled.
4. typedTypeApply needs to keep type applications that apply to type tests and type casts as well as
array ops.
5. References to self-ids are typed ThisType(cls) before erasure; are replaced by This(cls) references
during erasure.
Diffstat (limited to 'tests/pos/unions.scala')
-rw-r--r-- | tests/pos/unions.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/pos/unions.scala b/tests/pos/unions.scala new file mode 100644 index 000000000..779d1847e --- /dev/null +++ b/tests/pos/unions.scala @@ -0,0 +1,14 @@ +object unions { + + class A { + def f: String = "abc" + } + + class B { + def f: String = "bcd" + } + + val x: A | B = if (true) new A else new B + println(x.f) + +} |