Skip to content

Commit

Permalink
Cleanup comments
Browse files Browse the repository at this point in the history
  • Loading branch information
KacperFKorban committed Jun 25, 2021
1 parent 5ba81a5 commit 2a8fcb8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ trait ClassLikeSupport:
Inkuire.db = Inkuire.db.copy(types = Inkuire.db.types.updated(t.itid.get, (t, Seq.empty)))
}

classDef
.symbol
.declaredMethods
classDef.symbol.declaredMethods
.filter { (s: Symbol) =>
!s.flags.is(Flags.Private) &&
!s.flags.is(Flags.Protected) &&
Expand All @@ -133,6 +131,7 @@ trait ClassLikeSupport:
from match
case Some(from) => Inkuire.db = Inkuire.db.copy(implicitConversions = Inkuire.db.implicitConversions :+ (from.itid.get -> to))
case None =>

case methodSymbol: Symbol =>
val defdef = methodSymbol.tree.asInstanceOf[DefDef]
val methodVars = defdef.paramss.flatMap(_.params).collect {
Expand All @@ -152,7 +151,7 @@ trait ClassLikeSupport:
result = defdef.returnTpt.asInkuire(vars, false),
context = Inkuire.SignatureContext(
vars = vars.toSet,
constraints = Map.empty //TODO for future
constraints = Map.empty //TODO [Inkuire] Type bounds
)
),
name = methodSymbol.name,
Expand Down
28 changes: 14 additions & 14 deletions scaladoc/src/dotty/tools/scaladoc/tasty/InkuireSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ trait InkuireSupport:
partialAsInkuire(vars, isVariable)(tpeTree)

def partialAsInkuire(vars: Set[String], isVariable: Boolean): PartialFunction[Tree, Inkuire.Type] = {
case TypeBoundsTree(low, high) => inner(low.tpe, vars) //TODO
case TypeBoundsTree(low, high) => inner(low.tpe, vars) //TODO [Inkuire] Type bounds
case tpeTree: Applied =>
inner(tpeTree.tpe, vars).copy(
params = tpeTree.args.map(p => Inkuire.Invariance(p.asInkuire(vars, isVariable))) //TODO check variance
params = tpeTree.args.map(p => Inkuire.Invariance(p.asInkuire(vars, isVariable)))
)
case tpeTree: TypeTree =>
inner(tpeTree.tpe, vars)
Expand Down Expand Up @@ -65,7 +65,7 @@ trait InkuireSupport:
name = Inkuire.TypeName(normalizedName),
itid = argument.symbol.itid,
isVariable = vars.contains(normalizedName) || isVariable,
params = Seq.empty //TODO in future arities of params will be needed
params = Seq.empty //TODO [Inkuire] Type Lambdas
)
if argument.symbol.flags.is(Flags.Covariant) then Inkuire.Covariance(t)
else if argument.symbol.flags.is(Flags.Contravariant) then Inkuire.Contravariance(t)
Expand All @@ -86,8 +86,8 @@ trait InkuireSupport:
case _ => false

private def inner(tp: TypeRepr, vars: Set[String]): Inkuire.Type = tp match
case OrType(left, right) => inner(left, vars) //TODO for future
case AndType(left, right) => inner(left, vars) //TODO for future
case OrType(left, right) => inner(left, vars) //TODO [Inkuire] Or/AndTypes
case AndType(left, right) => inner(left, vars) //TODO [Inkuire] Or/AndTypes
case ByNameType(tpe) => inner(tpe, vars)
case ConstantType(constant) =>
Inkuire.Type(
Expand All @@ -97,15 +97,15 @@ trait InkuireSupport:
)
case ThisType(tpe) => inner(tpe, vars)
case AnnotatedType(AppliedType(_, Seq(tpe)), annotation) if isRepeatedAnnotation(annotation) =>
inner(tpe, vars) //TODO for future
inner(tpe, vars) //TODO [Inkuire] Repeated types
case AppliedType(repeatedClass, Seq(tpe)) if isRepeated(repeatedClass) =>
inner(tpe, vars) //TODO for future
inner(tpe, vars) //TODO [Inkuire] Repeated types
case AnnotatedType(tpe, _) =>
inner(tpe, vars)
case tl @ TypeLambda(params, paramBounds, resType) =>
inner(resType, vars) //TODO for future
inner(resType, vars) //TODO [Inkuire] Type lambdas
case r: Refinement =>
inner(r.info, vars) //TODO for future
inner(r.info, vars) //TODO [Inkuire] Refinements
case t @ AppliedType(tpe, typeList) =>
import dotty.tools.dotc.util.Chars._
if t.isFunctionType then
Expand All @@ -125,7 +125,7 @@ trait InkuireSupport:
else
inner(tpe, vars).copy(
params = typeList.map(p => Inkuire.Invariance(inner(p, vars)))
) //TODO check if it's ok (Having resolver should mean that variance here isn't meaningful)
)
case tp: TypeRef =>
Inkuire.Type(
name = Inkuire.TypeName(tp.name),
Expand All @@ -136,20 +136,20 @@ trait InkuireSupport:
case tr @ TermRef(qual, typeName) =>
inner(qual, vars)
case TypeBounds(low, hi) =>
inner(low, vars) //TODO for future
inner(low, vars) //TODO [Inkuire] Type bounds
case NoPrefix() =>
Inkuire.Type.unresolved //TODO check <- should be handled by Singleton case, but doesn't work
Inkuire.Type.unresolved //TODO [Inkuire] <- should be handled by Singleton case, but didn't work
case MatchType(bond, sc, cases) =>
inner(sc, vars)
case ParamRef(TypeLambda(names, _, resType), i) =>
Inkuire.Type(
name = Inkuire.TypeName(names(i)),
itid = Some(Inkuire.ITID(s"external-itid-${names(i)}", isParsed = false)), //TODO check if it's possible to get the actual ITID(DRI)
itid = Some(Inkuire.ITID(s"external-itid-${names(i)}", isParsed = false)),
isVariable = true
)
case ParamRef(m: MethodType, i) =>
inner(m.paramTypes(i), vars)
case RecursiveType(tp) =>
inner(tp, vars)
case MethodType(_, params, resType) =>
inner(resType, vars) //TODO for future
inner(resType, vars) //TODO [Inkuire] Method type

0 comments on commit 2a8fcb8

Please sign in to comment.