File tree 4 files changed +34
-1
lines changed
compiler/src/dotty/tools/dotc/typer
4 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -984,7 +984,7 @@ class Typer extends Namer
984
984
val accu = new TypeAccumulator [Set [Symbol ]] {
985
985
def apply (tsyms : Set [Symbol ], t : Type ): Set [Symbol ] = {
986
986
val tsyms1 = t match {
987
- case tr : TypeRef if (tr.symbol is TypeParam ) && tr.symbol.owner.isTerm && variance == 0 =>
987
+ case tr : TypeRef if (tr.symbol is TypeParam ) && variance == 0 =>
988
988
tsyms + tr.symbol
989
989
case _ =>
990
990
tsyms
Original file line number Diff line number Diff line change
1
+ enum Expr [T ] {
2
+ case IExpr (value : Int ) extends Expr [Int ]
3
+ case BExpr (value : Boolean ) extends Expr [Boolean ]
4
+
5
+ def join (other : Expr [T ]): Expr [T ] = (this , other) match {
6
+ case (IExpr (i1), IExpr (i2)) => IExpr (i1 + i2)
7
+ case (BExpr (b1), BExpr (b2)) => BExpr (b1 & b2)
8
+ }
9
+ }
Original file line number Diff line number Diff line change
1
+ sealed trait Expr [T ] {
2
+ import Expr ._
3
+
4
+ def join (other : Expr [T ]): Expr [T ] = (this , other) match {
5
+ case (IExpr (i1), IExpr (i2)) => IExpr (i1 + i2)
6
+ case (BExpr (b1), BExpr (b2)) => BExpr (b1 & b2)
7
+ }
8
+ }
9
+
10
+ object Expr {
11
+ case class IExpr (value : Int ) extends Expr [Int ]
12
+ case class BExpr (value : Boolean ) extends Expr [Boolean ]
13
+ }
Original file line number Diff line number Diff line change
1
+ sealed trait Expr [T ] { outer =>
2
+ class Inner {
3
+ def join (other : Expr [T ]): Expr [T ] = (outer, other) match {
4
+ case (IExpr (i1), IExpr (i2)) => IExpr (i1 + i2)
5
+ case (BExpr (b1), BExpr (b2)) => BExpr (b1 & b2)
6
+ }
7
+ }
8
+ }
9
+
10
+ case class IExpr (value : Int ) extends Expr [Int ]
11
+ case class BExpr (value : Boolean ) extends Expr [Boolean ]
You can’t perform that action at this time.
0 commit comments