From 5b1a05e2826ae222b0cedce740b809ae318af392 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Tue, 14 Apr 2026 19:58:44 +0200 Subject: [PATCH] fixes #18095 (#25744) --- compiler/semtypes.nim | 2 +- tests/metatype/deps/cisaorb.nim | 8 ++++++++ tests/metatype/tcisaorb.nim | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/metatype/deps/cisaorb.nim create mode 100644 tests/metatype/tcisaorb.nim diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 46ef4f77f2..0b26cb8b8f 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -2380,7 +2380,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = else: result = typeExpr.typ.base if result.isMetaType and - result.kind != tyUserTypeClass: + result.kind notin tyTypeClasses: # the dot expression may refer to a concept type in # a different module. allow a normal alias then. let preprocessed = semGenericStmt(c, n) diff --git a/tests/metatype/deps/cisaorb.nim b/tests/metatype/deps/cisaorb.nim new file mode 100644 index 0000000000..3cf0a5d523 --- /dev/null +++ b/tests/metatype/deps/cisaorb.nim @@ -0,0 +1,8 @@ +type + A* = object + discard + + B* = object + discard + + C* = A | B diff --git a/tests/metatype/tcisaorb.nim b/tests/metatype/tcisaorb.nim new file mode 100644 index 0000000000..80d6531aac --- /dev/null +++ b/tests/metatype/tcisaorb.nim @@ -0,0 +1,22 @@ +discard """ + action: "compile" +""" +import deps/cisaorb + +when true: + # These work fine. + discard default(cisaorb.A) + proc f1(x: cisaorb.A) = discard + discard default(cisaorb.B) + proc f2(x: cisaorb.B) = discard + discard default(A) + proc f3(x: A) = discard + discard default(B) + proc f4(x: B) = discard + proc f5(x: C) = discard + proc f6(x: cisaorb.C | C) = discard + +proc doesWork(x: A | B) = discard + +# Doesn't compile. +proc f(x: cisaorb.C) = discard