Skip to content

Intersection of nullary and nilary crashes compiler #7425

@lrytz

Description

@lrytz
scala> class C { def f: Int = 0 }
// defined class C

scala> class D { def f(): Int = 0 }
// defined class D

scala> def foo(x: C & D) = x.f
assertion failure for (C & D)(x) <:< ?{ f: ? }, frozen = false
Exception in thread "main" java.lang.AssertionError: assertion failed: Int & (): Int / TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),class Int) & MethodType(List(), List(), TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),class Int))
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.core.Types$AndType$.apply(Types.scala:2777)
	at dotty.tools.dotc.core.TypeComparer.andType$$anonfun$1(TypeComparer.scala:1924)
	at dotty.tools.dotc.core.TypeComparer.liftIfHK(TypeComparer.scala:1963)
	at dotty.tools.dotc.core.TypeComparer.andTypeGen(TypeComparer.scala:1901)
	at dotty.tools.dotc.core.TypeComparer.andType(TypeComparer.scala:1924)
	at dotty.tools.dotc.core.TypeComparer.glb(TypeComparer.scala:1723)
	at dotty.tools.dotc.core.Types$Type.$amp(Types.scala:950)
	at dotty.tools.dotc.core.Denotations$.infoMeet(Denotations.scala:656)
	at dotty.tools.dotc.core.Denotations$Denotation.mergeSingleDenot$1(Denotations.scala:481)
	at dotty.tools.dotc.core.Denotations$Denotation.mergeDenot$1(Denotations.scala:401)
	at dotty.tools.dotc.core.Denotations$Denotation.$amp(Denotations.scala:504)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions