Skip to content

Commit 80f3565

Browse files
committed
Simplify class symbol check for OnlyCapability
1 parent 6c32869 commit 80f3565

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureOps.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -922,11 +922,8 @@ object OnlyCapability:
922922

923923
def unapply(tree: AnnotatedType)(using Context): Option[(Type, ClassSymbol)] = tree match
924924
case AnnotatedType(parent: Type, ann) if ann.hasSymbol(defn.OnlyCapabilityAnnot) =>
925-
ann.tree.tpe.argTypes.head.dealias match
926-
case tp: TypeRef if tp.symbol.isClass =>
927-
tp.symbol match
928-
case cls: ClassSymbol => Some((parent, cls))
929-
case _ => None
925+
ann.tree.tpe.argTypes.head.dealias.typeSymbol match
926+
case cls: ClassSymbol => Some((parent, cls))
930927
case _ => None
931928
case _ => None
932929
end OnlyCapability

0 commit comments

Comments
 (0)