File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -1862,18 +1862,20 @@ class Namer { typer: Typer =>
1862
1862
sym.setParamss(paramSymss)
1863
1863
1864
1864
/** Set every context bound evidence parameter of a class to be tracked,
1865
- * provided it has a type that has an abstract type member. Reset private
1866
- * and local flags so that the parameter becomes a `val`. Do the same for all
1867
- * context bound evidence parameters of a `given` class. This is because
1868
- * in Desugar.addParamRefinements we create refinements for these parameters
1869
- * in the result type of the implicit access method.
1865
+ * provided it has a type that has an abstract type member and the parameter's
1866
+ * name is not a synthetic, unaddressable name. Reset private and local flags
1867
+ * so that the parameter becomes a `val`. Do the same for all context bound
1868
+ * evidence parameters of a `given` class. This is because in Desugar.addParamRefinements
1869
+ * we create refinements for these parameters in the result type of the implicit
1870
+ * access method.
1870
1871
*/
1871
1872
def setTracked (param : ValDef ): Unit =
1872
1873
val sym = symbolOfTree(param)
1873
1874
sym.maybeOwner.maybeOwner.infoOrCompleter match
1874
1875
case info : TempClassInfo =>
1875
1876
if ! sym.is(Tracked )
1876
1877
&& param.hasAttachment(ContextBoundParam )
1878
+ && ! param.name.is(ContextBoundParamName )
1877
1879
&& (sym.info.memberNames(abstractTypeNameFilter).nonEmpty
1878
1880
|| sym.maybeOwner.maybeOwner.is(Given ))
1879
1881
then
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import collection.mutable
3
3
4
4
// / A parser combinator.
5
5
trait Combinator :
6
-
7
6
type Self
8
7
type Input
9
8
type Result
@@ -13,21 +12,22 @@ trait Combinator:
13
12
def parse (in : Input ): Option [Result ]
14
13
end Combinator
15
14
16
- case class Apply [C , E ](action : C => Option [E ])
15
+ case class Apply [I , R ](action : I => Option [R ])
17
16
case class Combine [A , B ](first : A , second : B )
18
17
19
18
given [I , R ] => Apply [I , R ] is Combinator :
20
19
type Input = I
21
20
type Result = R
22
- extension (self : Self )
21
+ extension (self : Apply [ I , R ] )
23
22
def parse (in : I ): Option [R ] = self.action(in)
24
23
25
24
given [A : Combinator , B : Combinator { type Input = A .Input }]
26
25
=> Combine [A , B ] is Combinator :
27
26
type Input = A .Input
28
27
type Result = (A .Result , B .Result )
29
- extension (self : Self )
30
- def parse (in : Input ): Option [Result ] = ???
28
+ extension (self : Combine [A , B ])
29
+ def parse (in : Input ): Option [Result ] =
30
+ for x <- self.first.parse(in); y <- self.second.parse(in) yield (x, y)
31
31
32
32
extension [A ] (buf : mutable.ListBuffer [A ]) def popFirst () =
33
33
if buf.isEmpty then None
You can’t perform that action at this time.
0 commit comments