diff options
author | Martin Odersky <odersky@gmail.com> | 2015-03-03 10:39:04 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-03-18 11:14:14 +0100 |
commit | b0d73807db5e441badd48c189ef2bc35771021e7 (patch) | |
tree | 0baae222ea46a2cd02db41ffd2ab21f051f35ac2 /tests/pos/t1957.scala | |
parent | 6220d5c0a31d513cfcb28dba1df14176d527201d (diff) | |
download | dotty-b0d73807db5e441badd48c189ef2bc35771021e7.tar.gz dotty-b0d73807db5e441badd48c189ef2bc35771021e7.tar.bz2 dotty-b0d73807db5e441badd48c189ef2bc35771021e7.zip |
Better tracking of unhygienic closure types
We have two unhygienic closures left - one in t1957.scala the other in Typer.scala.
This commit leaves some printlns that can be uncommented to get more info on these.
It would be better to fix them but I am running out of time to do so. Maybe someone
else can pick up with the info this commit allows to recover. To find out more,
go to t1957.scala and read the comment.
Diffstat (limited to 'tests/pos/t1957.scala')
-rw-r--r-- | tests/pos/t1957.scala | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/tests/pos/t1957.scala b/tests/pos/t1957.scala index 711ce17de..2ac7f0414 100644 --- a/tests/pos/t1957.scala +++ b/tests/pos/t1957.scala @@ -1,3 +1,4 @@ +// See comment at end of file. object Test { abstract class Settings {} @@ -30,8 +31,32 @@ object Test { protected def f: List[commonModuleType] = { - val inputGrists = tools.flatMap(_.inputGrist) // val inputGrists: List[gristType] = - inputGrists.map(_.module) + val inputGrists = tools.flatMap(_.inputGrist) + // This produces an unhygienic closure for _.inputGrist. + // Pickling will log: + // + // [...] pickling reference to as yet undefined value _$1 in method $anonfun + // + // More info can be produced by uncommenting these two lines in + // Namer#valOrDefDefSig: + // + //println(i"lifting $rhsType over $paramss -> $hygienicType = ${tpt.tpe}") + //println(TypeComparer.explained { implicit ctx => hygienicType <:< tpt.tpe }) + // + // Tracing the subtype statement (over 1600+ lines!) shows that the TypeComparer thinks that the + // following subtype judgement is true: + // + // Test.Grist{ + // moduleType <: Test.Module{settingsType = Module.this.settingsType}; + // settingsType <: Module.this.settingsType + // } <:< Test.Grist{moduleType <: _$1.moduleType; settingsType <: _$1.settingsType} + // + // Therefore, a type variable which has the second type as lower bound does not get + // the (hygienic) first type as new lower bound. Clearly something is wrong in the subtype + // derivation here. It would be important to figure out what. + + ??? +// inputGrists.map(_.module) } } |