[#839] | project: compiler | priority: low | category: bug | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Sean | Martin | fixed | 2006-11-26 16:49:44.0 | |
subject | Refined type lost through def with nested type. | |||
code |
// see pending/pos/bug112606A.scala package test; trait Test { trait Global { type Tree; def get : Tree; } trait TreeBuilder { val global : Global; def set(tree : global.Tree) = {} } val nsc : Global; trait FileImpl { object treeBuilder extends TreeBuilder { val global : nsc.type = nsc; } // OK treeBuilder.set(nsc.get); } val file0 : FileImpl; // OK file0.treeBuilder.set(nsc.get); def file : FileImpl; // type mismatch file.treeBuilder.set(nsc.get); } |
|||
what happened | type mismatch; found : Test.this.nsc.Tree required: scala.Nothing test37/src/test Test.scala line 21Note that the first two treeBuilder.set calls compile without error (meaning the type is not erased through this\ or through a val of FileImpl). So obviously there is a bug somewhere. |
|||
what expected | For all treeBuilder.set calls to either pass (preferably) or fail (will at least be consistent). | |||
[back to overview] |
Martin edited on 2006-12-01 16:08:55.0 |
The example is in error, but the error was masked. You now get:
bug839.scala:25 error: method set cannot be accessed in object Test.this.FileImpl#treeBuilder because its instance type (Test.this.FileImpl#treeBuilder#global.Tree)scala.Unit contains a malformed type: object Test.this.FileImpl#treeBuilder#global file.treeBuilder.set(nsc.get); ^ one error found |