Skip to content

Commit d220fe3

Browse files
committed
Remove isVariable flag
1 parent 7b4091b commit d220fe3

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ trait ClassLikeSupport:
9696

9797
if summon[DocContext].args.generateInkuire then {
9898

99-
val classType = classDef.asInkuire(Set.empty, true)
99+
val classType = classDef.asInkuire(Set.empty)
100100
val variableNames = classType.params.map(_.typ.name.name).toSet
101101

102-
val parents = classDef.parents.map(_.asInkuire(variableNames, false))
102+
val parents = classDef.parents.map(_.asInkuire(variableNames))
103103

104104
val isModule = classDef.symbol.flags.is(Flags.Module)
105105

@@ -109,8 +109,8 @@ trait ClassLikeSupport:
109109
case typeSymbol: Symbol =>
110110
val typeDef = typeSymbol.tree.asInstanceOf[TypeDef]
111111
if typeDef.rhs.symbol.fullName.contains("java") then
112-
val t = typeSymbol.tree.asInkuire(variableNames, false) // TODO [Inkuire] Hack until type aliases are supported
113-
val tJava = typeDef.rhs.symbol.tree.asInkuire(variableNames, false)
112+
val t = typeSymbol.tree.asInkuire(variableNames) // TODO [Inkuire] Hack until type aliases are supported
113+
val tJava = typeDef.rhs.symbol.tree.asInkuire(variableNames)
114114
Inkuire.db = Inkuire.db.copy(types = Inkuire.db.types.updated(t.itid.get, (t, Seq.empty))) // TODO [Inkuire] Hack until type aliases are supported
115115
Inkuire.db = Inkuire.db.copy(types = Inkuire.db.types.updated(tJava.itid.get, (tJava, Seq.empty)))
116116
}
@@ -126,9 +126,9 @@ trait ClassLikeSupport:
126126
&& classDef.symbol.flags.is(Flags.Module)
127127
&& implicitConversion.owner.fullName == ("scala.Predef$") =>
128128
val defdef = implicitConversion.tree.asInstanceOf[DefDef]
129-
val to = defdef.returnTpt.asInkuire(variableNames, false)
129+
val to = defdef.returnTpt.asInkuire(variableNames)
130130
val from = defdef.paramss.flatMap(_.params).collectFirst {
131-
case v: ValDef => v.tpt.asInkuire(variableNames, false)
131+
case v: ValDef => v.tpt.asInkuire(variableNames)
132132
}
133133
from match
134134
case Some(from) => Inkuire.db = Inkuire.db.copy(implicitConversions = Inkuire.db.implicitConversions :+ (from.itid.get -> to))
@@ -143,14 +143,14 @@ trait ClassLikeSupport:
143143
val receiver: Option[Inkuire.Type] =
144144
Some(classType)
145145
.filter(_ => !isModule)
146-
.orElse(methodSymbol.extendedSymbol.flatMap(s => partialAsInkuire(vars, false).lift(s.tpt)))
146+
.orElse(methodSymbol.extendedSymbol.flatMap(s => partialAsInkuire(vars).lift(s.tpt)))
147147
val sgn = Inkuire.ExternalSignature(
148148
signature = Inkuire.Signature(
149149
receiver = receiver,
150150
arguments = methodSymbol.nonExtensionParamLists.flatMap(_.params).collect {
151-
case ValDef(_, tpe, _) => tpe.asInkuire(vars, false)
151+
case ValDef(_, tpe, _) => tpe.asInkuire(vars)
152152
},
153-
result = defdef.returnTpt.asInkuire(vars, false),
153+
result = defdef.returnTpt.asInkuire(vars),
154154
context = Inkuire.SignatureContext(
155155
vars = vars.toSet,
156156
constraints = Map.empty //TODO [Inkuire] Type bounds

scaladoc/src/dotty/tools/scaladoc/tasty/InkuireSupport.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,36 @@ trait InkuireSupport:
1717

1818
private given qctx.type = qctx
1919

20-
private def paramsForClass(classDef: ClassDef, vars: Set[String], isVariable: Boolean): Seq[Inkuire.Variance] =
21-
classDef.getTypeParams.map(mkTypeArgumentInkuire(_, vars, isVariable))
20+
private def paramsForClass(classDef: ClassDef, vars: Set[String]): Seq[Inkuire.Variance] =
21+
classDef.getTypeParams.map(mkTypeArgumentInkuire(_, vars))
2222

2323
given TreeSyntaxInkuire: AnyRef with
2424
extension (tpeTree: Tree)
25-
def asInkuire(vars: Set[String], isVariable: Boolean): Inkuire.Type =
26-
partialAsInkuire(vars, isVariable)(tpeTree)
25+
def asInkuire(vars: Set[String]): Inkuire.Type =
26+
partialAsInkuire(vars)(tpeTree)
2727

28-
def partialAsInkuire(vars: Set[String], isVariable: Boolean): PartialFunction[Tree, Inkuire.Type] = {
28+
def partialAsInkuire(vars: Set[String]): PartialFunction[Tree, Inkuire.Type] = {
2929
case TypeBoundsTree(low, high) => inner(low.tpe, vars) //TODO [Inkuire] Type bounds
3030
case tpeTree: Applied =>
3131
inner(tpeTree.tpe, vars).copy(
32-
params = tpeTree.args.map(p => Inkuire.Invariance(p.asInkuire(vars, isVariable)))
32+
params = tpeTree.args.map(p => Inkuire.Invariance(p.asInkuire(vars)))
3333
)
3434
case tpeTree: TypeTree =>
3535
inner(tpeTree.tpe, vars)
3636
case term: Term => inner(term.tpe, vars)
37-
case classDef: ClassDef => mkTypeFromClassDef(classDef, vars, isVariable)
37+
case classDef: ClassDef => mkTypeFromClassDef(classDef, vars)
3838
case typeDef: TypeDef =>
3939
Inkuire.Type(
4040
name = Inkuire.TypeName(typeDef.name),
4141
itid = typeDef.symbol.itid
4242
)
4343
}
4444

45-
def mkTypeFromClassDef(classDef: ClassDef, vars: Set[String], isVariable: Boolean): Inkuire.Type = {
45+
def mkTypeFromClassDef(classDef: ClassDef, vars: Set[String]): Inkuire.Type = {
4646
Inkuire.Type(
4747
name = Inkuire.TypeName(classDef.name),
4848
itid = classDef.symbol.itid,
49-
params = paramsForClass(classDef, vars, isVariable)
49+
params = paramsForClass(classDef, vars)
5050
)
5151
}
5252

@@ -58,13 +58,13 @@ trait InkuireSupport:
5858
extension (tpe: TypeRepr)
5959
def asInkuire(vars: Set[String]): Inkuire.Type = inner(tpe, vars)
6060

61-
def mkTypeArgumentInkuire(argument: TypeDef, vars: Set[String] = Set.empty, isVariable: Boolean = false): Inkuire.Variance =
61+
def mkTypeArgumentInkuire(argument: TypeDef, vars: Set[String] = Set.empty): Inkuire.Variance =
6262
val name = argument.symbol.normalizedName
6363
val normalizedName = if name.matches("_\\$\\d*") then "_" else name
6464
val t = Inkuire.Type(
6565
name = Inkuire.TypeName(normalizedName),
6666
itid = argument.symbol.itid,
67-
isVariable = vars.contains(normalizedName) || isVariable,
67+
isVariable = true,
6868
params = Seq.empty //TODO [Inkuire] Type Lambdas
6969
)
7070
if argument.symbol.flags.is(Flags.Covariant) then Inkuire.Covariance(t)
@@ -141,7 +141,7 @@ trait InkuireSupport:
141141
Inkuire.Type.unresolved //TODO [Inkuire] <- should be handled by Singleton case, but didn't work
142142
case MatchType(bond, sc, cases) =>
143143
inner(sc, vars)
144-
case ParamRef(TypeLambda(names, _, resType), i) =>
144+
case ParamRef(TypeLambda(names, _, _), i) =>
145145
Inkuire.Type(
146146
name = Inkuire.TypeName(names(i)),
147147
itid = Some(Inkuire.ITID(s"external-itid-${names(i)}", isParsed = false)),

0 commit comments

Comments
 (0)