@@ -2027,12 +2027,19 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
20272027 var checkedArgs = preCheckKinds(args1, paramBounds)
20282028 // check that arguments conform to bounds is done in phase PostTyper
20292029 val tycon = tpt1.symbol
2030- if (tycon == defn.andType)
2031- checkedArgs = checkedArgs.mapconserve(arg =>
2032- checkSimpleKinded(checkNoWildcard(arg)))
2033- else if (tycon == defn.orType)
2030+ if tycon == defn.andType || tycon == defn.orType then
20342031 checkedArgs = checkedArgs.mapconserve(arg =>
20352032 checkSimpleKinded(checkNoWildcard(arg)))
2033+ else if tycon.isProvisional then
2034+ // A type with Provisional flag is either an alias or abstract type.
2035+ // If it is an alias type, it would mean the type is cyclic
2036+ // If it is an abstract type, it would mean the type is an irreducible
2037+ // application of a higher-kinded type to a wildcard argument.
2038+ // Either way, the wildcard argument is illegal. The early test of
2039+ // `checkNoWildcard` here is needed, so that we do not accidentally reduce
2040+ // an application of a Provisional type away, which would mean that the type constructor
2041+ // is no longer present on the right hand side. See neg/i15507.scala.
2042+ checkedArgs = checkedArgs.mapconserve(checkNoWildcard)
20362043 else if tycon == defn.throwsAlias
20372044 && checkedArgs.length == 2
20382045 && checkedArgs(1 ).tpe.derivesFrom(defn.RuntimeExceptionClass )
0 commit comments