Closed metagn closed 3 weeks ago
Thanks for your hard work on this PR! The lines below are statistics of the Nim compiler built from 67ad1ae1598b08039c971812dc172dd48624b7b0
Hint: mm: orc; opt: speed; options: -d:release 176961 lines; 8.650s; 653.582MiB peakmem
fixes issue described in https://forum.nim-lang.org/t/12579
In #24065 explicit generic parameter matching was made to fail matches on arguments with unresolved types in generic contexts (the sigmatch diff, following #24010), similar to what is done for regular calls since #22029. However unlike regular calls, a failed match in a generic context for a standalone explicit generic instantiation did not convert the expression into one with
tyFromExpr
type, which means it would error immediately given any unresolved parameter. This is now done to fix the issue.For explicit generic instantiations on single non-overloaded symbols, a successful match is still instantiated. For multiple overloads (i.e. symchoice), if any of the overloads fail the match, the entire expression is considered untyped and any instantiations are not used, so as to not void overloads that would match later. This means even symchoices without unresolved arguments aren't instantiated, which may be too restrictive, but it could also be too lenient and we might need to make symchoice instantiations always untyped. The behavior for symchoice is not sound anyway given it causes #9997 so this is something to consider for a redesign.
Diff follows #24276.