File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -1230,15 +1230,19 @@ object desugar {
12301230 case td @ TypeDef (name, cb @ ContextBounds (bounds, ctxBounds)) =>
12311231 TypeDef (name, ContextBounds (bounds, List .empty))
12321232 }
1233- var idx = - 1
1233+ var idx = 0
12341234 val collecedContextBounds = tparams.collect {
12351235 case td @ TypeDef (name, cb @ ContextBounds (bounds, ctxBounds)) if ctxBounds.nonEmpty =>
12361236 // TOOD(kπ) Should we handle non empty normal bounds here?
12371237 name -> ctxBounds
12381238 }.flatMap { case (name, ctxBounds) =>
12391239 ctxBounds.map { ctxBound =>
12401240 idx = idx + 1
1241- makeSyntheticParameter(idx, ctxBound).withAddedFlags(Given )
1241+ ctxBound match
1242+ case ContextBoundTypeTree (_, _, ownName) =>
1243+ ValDef (ownName, ctxBound, EmptyTree ).withFlags(TermParam | Given )
1244+ case _ =>
1245+ makeSyntheticParameter(idx, ctxBound).withAddedFlags(Given )
12421246 }
12431247 }
12441248 val contextFunctionResult =
Original file line number Diff line number Diff line change @@ -7,9 +7,11 @@ trait Ord[X]:
77
88val less1 = [X : Ord ] => (x : X , y : X ) => summon[Ord [X ]].compare(x, y) < 0
99
10+ val less2 = [X : Ord as ord ] => (x : X , y : X ) => ord.compare(x, y) < 0
11+
1012// type Comparer = [X: Ord] => (x: X, y: X) => Boolean
11- // val less2 : Comparer = [X: Ord as ord] => (x: X, y: X) => ord.compare(x, y) < 0
13+ // val less3 : Comparer = [X: Ord as ord] => (x: X, y: X) => ord.compare(x, y) < 0
1214
1315// type Cmp[X] = (x: X, y: X) => Boolean
1416// type Comparer2 = [X: Ord] => Cmp[X]
15- // val less3 : Comparer2 = [X: Ord] => (x: X, y: X) => summon[Ord[X]].compare(x, y) < 0
17+ // val less4 : Comparer2 = [X: Ord] => (x: X, y: X) => summon[Ord[X]].compare(x, y) < 0
You can’t perform that action at this time.
0 commit comments