This commit is contained in:
Andreas Rumpf
2026-04-14 19:58:44 +02:00
committed by GitHub
parent 4dbc382906
commit 5b1a05e282
3 changed files with 31 additions and 1 deletions

View File

@@ -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)

View File

@@ -0,0 +1,8 @@
type
A* = object
discard
B* = object
discard
C* = A | B

View File

@@ -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