Skip to content

problems existentially quantifying prefix of a module type #8419

Open
@scabug

Description

@scabug

https://groups.google.com/forum/#!topic/scala-language/qqbDyxaU24E

'm struggling to explain that behaviour, though: 

$ scala 
Welcome to Scala version 2.10.0-20121205-235900-18481cef9b (OpenJDK 
64-Bit Server VM, Java 1.7.0_09). 
Type in expressions to have them evaluated. 
Type :help for more information. 

scala> class X { object Y } 
defined class X 

scala> val x = new X 
x: X = X@4c769a3 

scala> type XY = x.Y.type forSome { val x: X } 
warning: there were 2 feature warnings; re-run with -feature for details 
defined type alias XY 

scala> val y1 = x.Y 
y1: x.Y.type = X$Y$@14eee870 

scala> val y2: XY = x.Y 
y2: XY = X$Y$@14eee870 

scala> val y2: (x.Y.type forSome { val x: X }) = x.Y 
<console>:9: error: type mismatch; 
 found   : x.Y.type 
 required: x.Y.type forSome { val x: => X } 
       val y2: (x.Y.type forSome { val x: X }) = x.Y 
                                                   ^ 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions