Skip to content

Commit 1cf5a60

Browse files
chengluyuLPTK
authored andcommitted
Compute ClassSymbol's arity directly from the tree
1 parent bddb9d5 commit 1cf5a60

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

hkmc2/shared/src/main/scala/hkmc2/semantics/Symbol.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,7 @@ class ClassSymbol(val tree: Tree.TypeDef, val id: Tree.Ident)
156156
def toLoc: Option[Loc] = id.toLoc // TODO track source tree of classe here
157157
override def toString: Str = s"class:$nme"
158158
/** Compute the arity. */
159-
def arity: Int = defn match
160-
case S(d) => d.paramsOpt.fold(0)(_.length)
161-
case N => tree.paramLists.headOption.fold(0)(_.fields.length)
159+
def arity: Int = tree.paramLists.headOption.fold(0)(_.fields.length)
162160

163161
class ModuleSymbol(val tree: Tree.TypeDef, val id: Tree.Ident)
164162
extends MemberSymbol[ModuleDef] with CtorSymbol with InnerSymbol:

0 commit comments

Comments
 (0)