File tree Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change 11trait  Null  extends  Any 
22object  Test  with 
3-   def  notNull (x : Any ):  x.type  &  NotNull  = 
3+   def  notNull [ A ] (x : A   |   Null ):  x.type  &  A  = 
44    assert(x !=  null )
55    x.asInstanceOf   //  TODO: drop the .asInstanceOf when explicit nulls are implemented
66
77  locally {
88    val  x :  (Int  |  Null ) =  ??? 
99    val  y  =  x; val  _:  Int  |  Null  =  y
1010  }
11-   locally {
12-     val  x :  (Int  |  Null ) &  NotNull  =  ??? 
13-     val  y  =  identity(x); val  yc :  Int  =  y
14-     val  z  =  x; val  zc :  Int  =  z
15-   }
1611  locally {
1712    val  x :  Int  |  Null  =  ??? 
1813    val  y  =  notNull(identity(x)); val  yc :  Int  =  y
1914    val  z  =  notNull(x); val  zc :  Int  =  z
2015  }
21-   locally {
22-     val  x :  Int  |  Null  =  ??? 
23-     val  y  =  identity(x).$nn; val  yc :  Int  =  y
24-     val  z  =  x.$nn; val  zc :  Int  =  z
25-   }
2616  class  C  { type  T  }
2717  locally {
2818    val  x :  C  { type  T  =  Int  } =  new  C  { type  T  =  Int  }
29-     val  y :  x.$nn.T  =  33 
19+     val  xnn :  x.type  &  C  { type  T  =  Int  } =  notNull(x)
20+     val  y :  xnn.T  =  33 
3021    val  z  =  y; val  zc :  Int  =  z
3122  }
32- 
33- 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments