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 @@ -2130,6 +2130,11 @@ class Namer { typer: Typer =>
21302130      val  pt  =  inherited.orElse(expectedDefaultArgType).orElse(fallbackProto).widenExpr
21312131      val  tp  =  typedAheadRhs(pt).tpe
21322132      if  (defaultTp eq pt) &&  (tp frozen_<:<  defaultTp) then 
2133+         //  See i21558, the default argument new A(1.0) is of type A[?T]
2134+         //  With an uninterpolated, invariant ?T type variable.
2135+         //  So before we return the default getter parameter type (A[? <: Double])
2136+         //  we want to force ?T to instantiate, so it's poly is removed from the constraint
2137+         isFullyDefined(tp, ForceDegree .all)
21332138        //  When possible, widen to the default getter parameter type to permit a
21342139        //  larger choice of overrides (see `default-getter.scala`).
21352140        //  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