Skip to content

Union and intersection types are not causing checking the kind of type parameters #16696

Closed
@bertlebee

Description

@bertlebee

Compiler version

3.2.1

Minimized code

https://scastie.scala-lang.org/VEozYp5OQlmLyTb0hn3KQw

Output (click arrow to expand)

java.lang.AssertionError: assertion failed: R & Playground.Foo / TypeParamRef(R) & HKTypeLambda(List(A), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any))), AppliedType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),module class Playground$)),trait Foo),List(TypeParamRef(A))))
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.core.Types$AndType$.apply(Types.scala:3203)
	at dotty.tools.dotc.core.Types$AndType$.make(Types.scala:3238)
	at dotty.tools.dotc.core.Types$AndType.derivedAndType(Types.scala:3184)
	at dotty.tools.dotc.core.Types$ApproximatingTypeMap.derivedAndType(Types.scala:5961)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5689)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:109)
	at dotty.tools.dotc.core.Types$TypeMap.op$proxy16$1(Types.scala:5590)
	at dotty.tools.dotc.core.Types$TypeMap.mapArgs(Types.scala:5590)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5627)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:109)
	at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5603)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:103)
	at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5603)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:103)
	at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5603)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:103)
	at dotty.tools.dotc.core.TypeOps$.asSeenFrom(TypeOps.scala:51)
	at dotty.tools.dotc.core.Types$Type.asSeenFrom(Types.scala:1036)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.derived$1(Denotations.scala:1099)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1125)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1079)
	at dotty.tools.dotc.core.Denotations$PreDenotation.asSeenFrom(Denotations.scala:134)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:2069)
	at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:686)
	at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:879)
	at dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:669)
	at dotty.tools.dotc.core.Types$Type.member(Types.scala:653)
	at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.liftedTree1$1(ProtoTypes.scala:195)
	at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.isMatchedBy(ProtoTypes.scala:217)
	at dotty.tools.dotc.core.TypeComparer.isMatchedByProto(TypeComparer.scala:1917)
	at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:314)
	at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1336)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:194)
	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:204)
	at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:128)
	at dotty.tools.dotc.core.TypeComparer.testSubType(TypeComparer.scala:144)
	at dotty.tools.dotc.core.TypeComparer$.testSubType(TypeComparer.scala:2767)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:3725)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3822)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4038)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3368)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2987)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions