Skip to content

Commit 1c1e7c0

Browse files
committed
Add some test cases with current limitations
1 parent 734f7a2 commit 1c1e7c0

File tree

5 files changed

+18
-66
lines changed

5 files changed

+18
-66
lines changed

Diff for: compiler/src/dotty/tools/dotc/ast/Desugar.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -978,8 +978,8 @@ object desugar {
978978
// we can reuse the constructor parameters; no derived params are needed.
979979
DefDef(
980980
className.toTermName, joinParams(constrTparams, defParamss), classTypeRef, creatorExpr
981-
) .withMods(companionMods | mods.flags.toTermFlags & (GivenOrImplicit | Inline) | finalFlag)
982-
.withSpan(cdef.span) :: Nil
981+
).withMods(companionMods | mods.flags.toTermFlags & (GivenOrImplicit | Inline) | finalFlag)
982+
.withSpan(cdef.span) :: Nil
983983
}
984984

985985
val self1 = {

Diff for: compiler/src/dotty/tools/dotc/typer/Namer.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -1935,10 +1935,10 @@ class Namer { typer: Typer =>
19351935
for params <- ddef.termParamss; param <- params do
19361936
val psym = symbolOfTree(param)
19371937
if needsTracked(psym, param, owningSym) then
1938-
psym.setFlag(Tracked)
19391938
for acc <- sym.maybeOwner.infoOrCompleter.decls.lookupAll(psym.name) if acc.is(ParamAccessor) do
19401939
acc.resetFlag(PrivateLocal)
19411940
acc.setFlag(Tracked)
1941+
psym.setFlag(Tracked)
19421942

19431943
if Feature.enabled(modularity) then addTrackedIfNeeded(ddef, sym.maybeOwner)
19441944

@@ -2078,12 +2078,12 @@ class Namer { typer: Typer =>
20782078
case _ =>
20792079

20802080
def inferredResultType(
2081-
mdef: ValOrDefDef,
2082-
sym: Symbol,
2083-
paramss: List[List[Symbol]],
2084-
paramFn: Type => Type,
2085-
fallbackProto: Type
2086-
)(using Context): Type =
2081+
mdef: ValOrDefDef,
2082+
sym: Symbol,
2083+
paramss: List[List[Symbol]],
2084+
paramFn: Type => Type,
2085+
fallbackProto: Type
2086+
)(using Context): Type =
20872087

20882088
/** A type for this definition that might be inherited from elsewhere:
20892089
* If this is a setter parameter, the corresponding getter type.

Diff for: compiler/test/dotc/pos-test-pickling.blacklist

-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ parsercombinators-new-syntax.scala
135135
hylolib-deferred-given
136136
hylolib-cb
137137
hylolib
138-
infer-tracked-parsercombinators-givens.scala
139138

140139
# typecheckErrors method unpickling
141140
i21415.scala

Diff for: tests/pos/infer-tracked-parsercombinators-givens.scala

-54
This file was deleted.

Diff for: tests/pos/infer-tracked.scala

+9-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ case class K(c: C):
2525
case class L(c: C):
2626
type T = c.T
2727

28+
class M
29+
30+
given mInst: (c: C) => M:
31+
def foo: c.T = c.foo
32+
2833
def Test =
2934
val c = new C:
3035
type T = Int
@@ -33,8 +38,7 @@ def Test =
3338
val f = new F(c)
3439
val _: Int = f.result
3540

36-
// Not really possible to work with inference in Namer, should emit a lint
37-
// val g = new G(c)
41+
// val g = new G(c) // current limitation of infering in Namer, should emit a lint
3842
// val _: Int = g.result
3943

4044
val h = new H(c)
@@ -51,3 +55,6 @@ def Test =
5155

5256
val l = L(c)
5357
summon[l.T =:= Int]
58+
59+
// val m = mInst(using c) // current limitation, we infer tracked after this desugaring
60+
// val _: Int = m.foo

0 commit comments

Comments
 (0)