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

test disabling fauxMatch #22193

Closed
wants to merge 2 commits into from
Closed

test disabling fauxMatch #22193

wants to merge 2 commits into from

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Jun 30, 2023

Test removing fauxMatch for tyUnknown = tyFromExpr as it may not be necessary anymore (#22189)

Failure in nimcrypto implies it is:

nimcrypto/hash.nim(52, 34) Error: cannot instantiate MDigest [type declared in nimcrypto/hash.nim(27, 3)]
got: <typeof(HashType.bits)>
but expected: <bits>
# in nimcrypto/hash.nim

type
  MDigest*[bits: static[int]] = object
    ## Message digest type
    data*: array[bits div 8, byte]

proc digest*(HashType: typedesc, data: ptr byte,
             ulen: uint): MDigest[HashType.bits] = # line 52
  ...

echo typeof(digest)
# proc (HashType: typedesc, data: ptr byte, ulen: uint): MDigest[typeof(HashType.bits)]

@metagn
Copy link
Collaborator Author

metagn commented Jun 30, 2023

Seems necessary but needs investigation (#22189 might have broken code with forwarded generic instantiations)

@metagn metagn closed this Jun 30, 2023
Araq pushed a commit that referenced this pull request Aug 28, 2024
…#24018)

updated version of #22193

After #22029 and the followups #23983 and #24005 which fixed issues with
it, `tyFromExpr` no longer match any proc params in generic type bodies
but delay all non-matching calls until the type is instantiated.
Previously the mechanism `fauxMatch` was used to pretend that any
failing match against `tyFromExpr` actually matched, but prevented the
instantiation of the type until later.

Since this mechanism is not needed anymore for `tyFromExpr`, it is now
only used for `tyError` to prevent cascading errors and changed to a
bool field for simplicity. A change in `semtypes` was also needed to
prevent calling `fitNode` on default param values resolving to type
`tyFromExpr` in generic procs for params with non-generic types, as this
would try to coerce the expression into a concrete type when it can't be
instantiated yet.

The aliases `tyProxy` and `tyUnknown` for `tyError` and `tyFromExpr` are
also removed for uniformity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant