mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-05 11:24:08 +00:00
@@ -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)
|
||||
|
||||
8
tests/metatype/deps/cisaorb.nim
Normal file
8
tests/metatype/deps/cisaorb.nim
Normal file
@@ -0,0 +1,8 @@
|
||||
type
|
||||
A* = object
|
||||
discard
|
||||
|
||||
B* = object
|
||||
discard
|
||||
|
||||
C* = A | B
|
||||
22
tests/metatype/tcisaorb.nim
Normal file
22
tests/metatype/tcisaorb.nim
Normal 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
|
||||
Reference in New Issue
Block a user