From 1cf5a60a07beff78d7a3f26765be03d314084e5a Mon Sep 17 00:00:00 2001 From: Luyu Cheng Date: Fri, 15 Nov 2024 03:44:57 +0800 Subject: [PATCH] Compute `ClassSymbol`'s arity directly from the tree --- hkmc2/shared/src/main/scala/hkmc2/semantics/Symbol.scala | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hkmc2/shared/src/main/scala/hkmc2/semantics/Symbol.scala b/hkmc2/shared/src/main/scala/hkmc2/semantics/Symbol.scala index 7cd2d85dd..f6810b4cd 100644 --- a/hkmc2/shared/src/main/scala/hkmc2/semantics/Symbol.scala +++ b/hkmc2/shared/src/main/scala/hkmc2/semantics/Symbol.scala @@ -156,9 +156,7 @@ class ClassSymbol(val tree: Tree.TypeDef, val id: Tree.Ident) def toLoc: Option[Loc] = id.toLoc // TODO track source tree of classe here override def toString: Str = s"class:$nme" /** Compute the arity. */ - def arity: Int = defn match - case S(d) => d.paramsOpt.fold(0)(_.length) - case N => tree.paramLists.headOption.fold(0)(_.fields.length) + def arity: Int = tree.paramLists.headOption.fold(0)(_.fields.length) class ModuleSymbol(val tree: Tree.TypeDef, val id: Tree.Ident) extends MemberSymbol[ModuleDef] with CtorSymbol with InnerSymbol: