Skip to content

Commit 8e22afd

Browse files
committed
Don't cache unforced typedArgs
Don't cache the result of an unforced typedArgs if it is a WildcardType. We might come back later and want the forced version.
1 parent 6d50a34 commit 8e22afd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,13 @@ object ProtoTypes {
304304
* with unknown parameter types - this will then cause a
305305
* "missing parameter type" error
306306
*/
307-
private def typedArgs(force: Boolean): List[Tree] = {
308-
if (state.typedArgs.size != args.length)
309-
state.typedArgs = args.mapconserve(cacheTypedArg(_, typer.typed(_), force))
310-
state.typedArgs
311-
}
307+
private def typedArgs(force: Boolean): List[Tree] =
308+
if (state.typedArgs.size == args.length) state.typedArgs
309+
else {
310+
val args1 = args.mapconserve(cacheTypedArg(_, typer.typed(_), force))
311+
if (!args1.contains(WildcardType)) state.typedArgs = args1
312+
args1
313+
}
312314

313315
def typedArgs: List[Tree] = typedArgs(force = true)
314316
def unforcedTypedArgs: List[Tree] = typedArgs(force = false)

0 commit comments

Comments
 (0)