File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed 
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1965,6 +1965,11 @@ class Namer { typer: Typer =>
19651965      val  pt  =  inherited.orElse(expectedDefaultArgType).orElse(fallbackProto).widenExpr
19661966      val  tp  =  typedAheadRhs(pt).tpe
19671967      if  (defaultTp eq pt) &&  (tp frozen_<:<  defaultTp) then 
1968+         //  See i21558, the default argument new A(1.0) is of type A[?T]
1969+         //  With an uninterpolated, invariant ?T type variable.
1970+         //  So before we return the default getter parameter type (A[? <: Double])
1971+         //  we want to force ?T to instantiate, so it's poly is removed from the constraint
1972+         isFullyDefined(tp, ForceDegree .all)
19681973        //  When possible, widen to the default getter parameter type to permit a
19691974        //  larger choice of overrides (see `default-getter.scala`).
19701975        //  For justification on the use of `@uncheckedVariance`, see
Original file line number Diff line number Diff line change 1+ class  Base 
2+ class  A [T  <:  Float ](val  f :  T ) extends  Base 
3+ 
4+ def  test () =  {
5+   m1(new  A (m2()));
6+ 
7+ }
8+ 
9+ def  m1 (x : Base ) =  {}
10+ def  m2 (p : A [?  <:  Float ] =  new  A (1.0f )):  Int  =  1 
Original file line number Diff line number Diff line change 1+ class  Base 
2+ class  A [T  <:  Double ](val  f :  T ) extends  Base 
3+ 
4+ class  Test : 
5+   def  test () =  m1(new  A (m2()))
6+ 
7+   def  m1 (x : Base ):  Unit  =  {}
8+   def  m2 (p : A [?  <:  Double ] =  new  A (1.0 )):  Int  =  2 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments