Skip to content

Commit 77f43f5

Browse files
committed
Fix skolemizeWildcardArgs
We sometimes got the wrong type symbol before, which gave a wring number of arguments. Detected when starting to bounds checking inferred types.
1 parent c77a494 commit 77f43f5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/src/dotty/tools/dotc/core/TypeOps.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,14 +370,16 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
370370
* In fact the current treatment for this sitiuation can so far only be classified as "not obviously wrong",
371371
* (maybe it still needs to be revised).
372372
*/
373-
def boundsViolations(args: List[Tree], boundss: List[TypeBounds], instantiate: (Type, List[Type]) => Type, app: Type)(implicit ctx: Context): List[BoundsViolation] = {
373+
def boundsViolations(args: List[Tree], boundss: List[TypeBounds],
374+
instantiate: (Type, List[Type]) => Type, app: Type)(
375+
implicit ctx: Context): List[BoundsViolation] = {
374376
val argTypes = args.tpes
375377

376378
/** Replace all wildcards in `tps` with `<app>#<tparam>` where `<tparam>` is the
377379
* type parameter corresponding to the wildcard.
378380
*/
379381
def skolemizeWildcardArgs(tps: List[Type], app: Type) = app match {
380-
case AppliedType(tycon, args) if tycon.typeSymbol.isClass && !scala2CompatMode =>
382+
case AppliedType(tycon: TypeRef, args) if tycon.typeSymbol.isClass && !scala2CompatMode =>
381383
tps.zipWithConserve(tycon.typeSymbol.typeParams) {
382384
(tp, tparam) => tp match {
383385
case _: TypeBounds => app.select(tparam)

0 commit comments

Comments
 (0)