Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include new concepts in typeclasses, makes containsGenericType work #24453

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/ast.nim
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ const
GcTypeKinds* = {tyRef, tySequence, tyString}

tyTypeClasses* = {tyBuiltInTypeClass, tyCompositeTypeClass,
tyUserTypeClass, tyUserTypeClassInst,
tyUserTypeClass, tyUserTypeClassInst, tyConcept,
tyAnd, tyOr, tyNot, tyAnything}

tyMetaTypes* = {tyGenericParam, tyTypeDesc, tyUntyped} + tyTypeClasses
Expand Down
3 changes: 0 additions & 3 deletions compiler/typeallowed.nim
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,6 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
result = typeAllowedAux(marker, t.skipModifier, kind, c, flags+{taHeap})
else:
result = t
of tyConcept:
if kind != skParam: result = t
else: result = nil

proc typeAllowed*(t: PType, kind: TSymKind; c: PContext; flags: TTypeAllowedFlags = {}): PType =
# returns 'nil' on success and otherwise the part of the type that is
Expand Down
17 changes: 17 additions & 0 deletions tests/concepts/tuninstantiated.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
block: # issue #24450
type
B = object
b: int
A = object
x: int
AConcept = concept
proc implementation(s: var Self, p1: B)

proc implementation(r: var A, p1: B)=
discard

proc accept(r: var AConcept)=
discard

var a = A()
a.accept()