Skip to content

Commit

Permalink
Fix pickling issue
Browse files Browse the repository at this point in the history
  • Loading branch information
KacperFKorban committed Sep 24, 2024
1 parent 1c36605 commit 44af0d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ object desugar {
val PolyFunction(tparams: List[untpd.TypeDef] @unchecked, fun @ Function(vparamTypes, res)) = tree: @unchecked
val newTParams = tparams.mapConserve {
case td @ TypeDef(name, cb @ ContextBounds(bounds, ctxBounds)) =>
TypeDef(name, ContextBounds(bounds, List.empty))
cpy.TypeDef(td)(name, bounds)
case t => t
}
var idx = 0
Expand Down
5 changes: 3 additions & 2 deletions tests/pos/contextbounds-for-poly-functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import scala.language.future
trait Ord[X]:
def compare(x: X, y: X): Int

// val less1 = [X: Ord] => (x: X, y: X) => summon[Ord[X]].compare(x, y) < 0
val less1 = [X: Ord] => (x: X, y: X) => summon[Ord[X]].compare(x, y) < 0

// val less2 = [X: Ord as ord] => (x: X, y: X) => ord.compare(x, y) < 0
val less2 = [X: Ord as ord] => (x: X, y: X) => ord.compare(x, y) < 0

type CtxFunctionRef = Ord[Int] ?=> Boolean
type ComparerRef = [X] => (x: X, y: X) => Ord[X] ?=> Boolean
type Comparer = [X: Ord] => (x: X, y: X) => Boolean
val less3: Comparer = [X: Ord as ord] => (x: X, y: X) => ord.compare(x, y) < 0
Expand Down

0 comments on commit 44af0d6

Please sign in to comment.