diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-06 18:33:44 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-07 10:05:15 +0200 |
commit | 9d330e3c839a52ddcb508ffb3c2660ce244fb92b (patch) | |
tree | e0f732fced5d9ca071b3cea45f91d2d9cd1a7e5a /test/files/pos | |
parent | ba402c457aecf7d94038534775b7b063d7d5bd9e (diff) | |
download | scala-9d330e3c839a52ddcb508ffb3c2660ce244fb92b.tar.gz scala-9d330e3c839a52ddcb508ffb3c2660ce244fb92b.tar.bz2 scala-9d330e3c839a52ddcb508ffb3c2660ce244fb92b.zip |
SI-6145 lax typing of args to synthetic case-labels
Use wildcard for the expected type of the arguments of a jump to a label
synthesized by the pattern matcher... except during erasure: we must take the
expected type into account as it drives the insertion of casts!
It's ok since we're typing the translation of well-typed code. The only "type
errors" we catch are skolem mismatches. (after erasure the existential types that
before caused problems have disappeared.)
It's necessary to balance GADT magic, SI-6145, CPS type-driven transforms and
other existential trickiness. I've exhausted all other semi-clean approaches I
could think of:
- the right thing to do -- packing existential types -- runs into limitations
in subtyping existential types,
- casting breaks SI-6145 (and it's an unnecessary cast at run time),
- not casting breaks GADT typing as it requires sneaking ill-typed trees
past typer
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/t6145.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/pos/t6145.scala b/test/files/pos/t6145.scala new file mode 100644 index 0000000000..28334d4420 --- /dev/null +++ b/test/files/pos/t6145.scala @@ -0,0 +1,11 @@ +object Test { + // the existential causes a cast and the cast makes searchClass not be in tail position + // can we get rid of the useless cast? + @annotation.tailrec + final def searchClass: Class[_] = { + "packageName" match { + case _ => + searchClass + } + } +}
\ No newline at end of file |