lower: generalise the *T-where-T-expected diagnostic to any pointer
The check only caught `for xs: (*m)` loop captures; passing a `*T` parameter or any pointer local where `T` is expected still slipped through to the LLVM verifier. Key the diagnostic on the lowered argument's type instead of the capture, so a `*Move` parameter forwarded into a by-value parameter is reported the same way. Ref-capture wording is preserved. Add example 216 (pointer-parameter case) alongside 215 (loop capture).
This commit is contained in:
@@ -0,0 +1 @@
|
||||
1
|
||||
10
tests/expected/216-pointer-param-value-arg-diagnostic.txt
Normal file
10
tests/expected/216-pointer-param-value-arg-diagnostic.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
error: argument 'm' has type '*Move', but 'Move' is expected here
|
||||
--> /Users/agra/projects/sx/examples/216-pointer-param-value-arg-diagnostic.sx:13:44
|
||||
|
|
||||
13 | forward :: (m: *Move) -> s64 { return take(m); }
|
||||
| ^
|
||||
|
||||
help: dereference it to pass the value: `m.*`
|
||||
|
|
||||
13 | m.*
|
||||
| ^
|
||||
Reference in New Issue
Block a user