summary refs log tree commit diff stats
path: root/compiler/nimpaths.nim
diff options
context:
space:
mode:
authorDan Rose <dan@digilabs.io>2022-08-15 17:37:10 -0500
committerGitHub <noreply@github.com>2022-08-15 18:37:10 -0400
commitc579243e0cdba83a07357637d4bcef8594263207 (patch)
tree318c4f28cb8da676c62c631ee3130218cb12118b /compiler/nimpaths.nim
parent691026f5076e4e0f1aea20fb56e3346a6c24e18c (diff)
downloadNim-c579243e0cdba83a07357637d4bcef8594263207.tar.gz
Pass check condition directly to if (#20217)
When checking conditions, pass `check` untyped argument directly to if. This results in better error messages when the condition is malformed.

Previously `check 1` would fail at compile time with `Error: type mismatch: got 'int literal(-2)' for '-2' but expected 'bool'`
Now it fails with `Error: type mismatch: got 'int literal(1)' for '1' but expected 'bool'`.

Similarly `check "foo"` would fail with
```
Error: type mismatch: got <string>
but expected one of:
proc `not`(a: typedesc): typedesc
  first type mismatch at position: 1
  required type for a: typedesc
  but expression '"somestring"' is of type: string
...
```
Now it fails with `Error: type mismatch: got 'string' for '"somestring"' but expected 'bool'`
Diffstat (limited to 'compiler/nimpaths.nim')
0 files changed, 0 insertions, 0 deletions
d='n137' href='#n137'>137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172