Skip to content

For an object X, X$ should be =:= to X.type #1447

Closed
@smarter

Description

@smarter

This works in scalac but not in dotty:

case object X

object Test {
  val Alias = X

  val x: X.type = Alias
}
error: type mismatch:
 found   : X(Test.Alias)
 required: X.type
  val x: X.type = Alias
                  ^

Logging shows the issue:

[log frontend] ==> isSubType X$(Test.Alias) <:< X.type class dotty.tools.dotc.core.Types$TermRefWithSignature, class dotty.tools.dotc.core.Types$TermRefWithSignature?
[log frontend]   ==> isSubType X$ <:< X.type class dotty.tools.dotc.core.Types$CachedTypeRef, class dotty.tools.dotc.core.Types$TermRefWithSignature?
[log frontend]   <== isSubType X$ <:< X.type class dotty.tools.dotc.core.Types$CachedTypeRef, class dotty.tools.dotc.core.Types$TermRefWithSignature = false
[log frontend] <== isSubType X$(Test.Alias) <:< X.type class dotty.tools.dotc.core.Types$TermRefWithSignature, class dotty.tools.dotc.core.Types$TermRefWithSignature = false

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions