summary refs log tree commit diff stats
path: root/compiler/parampatterns.nim
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2024-09-23 18:18:22 +0300
committerGitHub <noreply@github.com>2024-09-23 18:18:22 +0300
commitb9de2bb4f3864d264c3aeffdc630227448ad8c14 (patch)
treec05007bc45e2af21c18f64f59dbaa2abd76bc068 /compiler/parampatterns.nim
parent6f6e34ebb037cdc83f8ec24b0422e70fc70d7107 (diff)
downloadNim-b9de2bb4f3864d264c3aeffdc630227448ad8c14.tar.gz
fix `nil` literal giving itself type `untyped`/`typed` [backport] (#24165)
fixes #24164, regression from #20091

The expression `nil` as the default value of template parameter `x:
untyped` is typechecked with expected type `untyped` since #20091. The
expected type is checked if it matches the `nil` literal with a match
better than a subtype match, and the type is set to it if it does.
However `untyped` matches with a generic match which is better, so the
`nil` literal has type `untyped`. This breaks type matching for the
literal. So if the expected type is `untyped` or `typed`, it is now
ignored and the `nil` literal just has the `nil` type.
Diffstat (limited to 'compiler/parampatterns.nim')
0 files changed, 0 insertions, 0 deletions