File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed 
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -1921,13 +1921,21 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
19211921        NoType 
19221922    }
19231923
1924-     if  pt.existsPart(_.isInstanceOf [TypeVar ], StopAt .Static )
1925-         &&  untpd.isFunctionWithUnknownParamType(tree)
1926-         &&  ! calleeType.exists then 
1924+     def  instantiateInUnion (tp : Type ):  Unit  =  tp match 
1925+       case  tp : OrType  => 
1926+         instantiateInUnion(tp.tp1)
1927+         instantiateInUnion(tp.tp2)
1928+       case  tp : FlexibleType  => 
1929+         instantiateInUnion(tp.hi)
1930+       case  tp : TypeVar  => 
1931+         isFullyDefined(tp, ForceDegree .flipBottom)
1932+       case  _ => 
1933+ 
1934+     if  untpd.isFunctionWithUnknownParamType(tree) &&  ! calleeType.exists then 
19271935      //  try to instantiate `pt` if this is possible. If it does not
19281936      //  work the error will be reported later in `inferredParam`,
19291937      //  when we try to infer the parameter type.
1930-       isFullyDefined (pt,  ForceDegree .flipBottom )
1938+       instantiateInUnion (pt)
19311939
19321940    val  (protoFormals, resultTpt) =  decomposeProtoFunction(pt, params.length, tree.srcPos)
19331941
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments