if (!phase.erasedTypes) unique(new UniqueThisType(sym))

21 views
Skip to first unread message

Eugene Burmako

unread,
Apr 21, 2012, 2:05:40 PM4/21/12
to <scala-internals@googlegroups.com>
Stumbled upon this when found out that:

appliedType(ClassTpe, IntTpe) <: appliedType(ClassTpe, IntTpe.erasure) == false

Subtype check fails because erasure transforms ThisTypes for modules into PackageTypeRefs.

Why is this necessary? What else could be unexpectedly changed by erasure? That's important because I use tpe.erasure to build class tags.

martin odersky

unread,
Apr 21, 2012, 4:59:19 PM4/21/12
to scala-i...@googlegroups.com
Lots of things change. Essentially everything that is not a valid Java 1.4 type has to be transformed into one.

 - Martin

Eugene Burmako

unread,
Apr 21, 2012, 5:19:21 PM4/21/12
to scala-i...@googlegroups.com
All right, I've inserted postprocessing that reverts PackageTypeRefs back to ThisTypes, and everything seems to be okay now. 

What else might prevent me from using the result of tpe.erasure in pre-erasure setting? 

martin odersky

unread,
Apr 22, 2012, 5:09:20 AM4/22/12
to scala-i...@googlegroups.com
On Sat, Apr 21, 2012 at 10:19 PM, Eugene Burmako <eugene....@epfl.ch> wrote:
All right, I've inserted postprocessing that reverts PackageTypeRefs back to ThisTypes, and everything seems to be okay now. 

What else might prevent me from using the result of tpe.erasure in pre-erasure setting? 

Why do you need it? I do not think one should do it. It was not planned that way so all bets are off and nobody can guarantee that what you do is correct.

 - Martin 


Eugene Burmako

unread,
Apr 22, 2012, 5:18:12 AM4/22/12
to scala-i...@googlegroups.com
I use it to generate class tags.

Eugene Burmako

unread,
Apr 22, 2012, 5:23:09 AM4/22/12
to scala-i...@googlegroups.com
Also, it's a part of the public API, so imho we should either shut it down or fix it for pre-erasure use.

martin odersky

unread,
Apr 22, 2012, 5:25:35 AM4/22/12
to scala-i...@googlegroups.com
Let's look at it together on Monday. Would 10.30 work for you? -- Martin
--
Martin Odersky
Prof., EPFL and Chairman, Typesafe
PSED, 1015 Lausanne, Switzerland
Tel. EPFL: +41 21 693 6863
Tel. Typesafe: +41 21 691 4967

Eugene Burmako

unread,
Apr 22, 2012, 5:27:01 AM4/22/12
to scala-i...@googlegroups.com
Yep, see you at your office at 10.30.
Reply all
Reply to author
Forward
0 new messages