-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
do not match generic invocations to their base body types #24690
base: devel
Are you sure you want to change the base?
Conversation
try this as the if statement's body: elif x.kind == tyGenericBody and f[0] == x:
result = isGeneric
for i in 1 ..< len(f):
if not f[i].acceptsAllTypes:
# not specific enough
result = isNone
break with this defined in types.nim: proc acceptsAllTypes*(t: PType): bool =
result = false
if t.kind == tyAnything:
result = true
elif t.kind == tyGenericParam:
if tfImplicitTypeParam in t.flags:
result = true
if not(t.hasElementType) or t.elementType.kind == tyNone:
result = true actually this is similar to your first commit but there is no CI output. what happened? |
I opened the PR after the second commit, also CI is fine outside of that arraymancer PR (arraymancer CI is broken) there was just a lot of httpclient failures. The first commit didn't work for any "working" cases either. A problem with matching |
Ok that makes sense. So in the case of #5632 that should actually fail because it's attempting to match |
So what can we do to bring this over the finish line? |
Was waiting on mratsim/Arraymancer#674 to be merged, testing to see if it actually works since arraymancer's own CI is broken |
It does work but we should probably still wait for it to get merged as it would be bad to break arraymancer for this. |
hm, unless there's a strong reason not to, it does look .. convenient to support - ie the resolution can be inferred based on the information present therefore it should be (or rather, why not?) |
fixes #24688, refs #5632
This would make sense if generic body types as the type of expressions are purely symbolic and never valid for an actual generic expression, which should produce some invocation type instead (liftParamType produces a generic invocation with args as
tyAnything
or the param constraints). Not sure if there is a valid counter case to this.#5632 is a counter case which no longer works, but it doesn't really seem like a valid case, unless we still want to support it.
PR to arraymancer: mratsim/Arraymancer#674, doesn't mean I'm sure this is correct though