diff options
| author | Simon Rask <33556894+SimonRask@users.noreply.github.com> | 2023-08-21 16:26:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-21 16:26:05 +0200 |
| commit | 046029b1e21324c3b10b03423d9bd297b4eafe8f (patch) | |
| tree | d9c9dccae7b3a3eff545d80820b6802a9a73ea03 /tests | |
| parent | f6a4b8f97babf84913a4583be14059a574bd8bc8 (diff) | |
Add hint for missing method error for dictionary where a field with a function is present (#1922)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typ/compiler/dict.typ | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/typ/compiler/dict.typ b/tests/typ/compiler/dict.typ index b257394f..957ebe92 100644 --- a/tests/typ/compiler/dict.typ +++ b/tests/typ/compiler/dict.typ @@ -92,3 +92,23 @@ --- // Error: 3-15 cannot mutate a temporary value #((key: "val").other = "some") + +--- +#{ + let dict = ( + func: () => 1, + ) + // Error: 3-14 type dictionary has no method `func` + // Hint: 3-14 to call the function stored in the dictionary, surround the field access with parentheses + dict.func() +} + +--- +#{ + let dict = ( + nonfunc: 1 + ) + + // Error: 3-17 type dictionary has no method `nonfunc` + dict.nonfunc() +}
\ No newline at end of file |
