-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove conflicting
default
call in tables.getOrDefault (#24265)
fixes #23587 As explained in the issue, `getOrDefault` has a parameter named `default` that can be a proc after generic instantiation. But the parameter having a proc type [overrides all other overloads](https://github.com/nim-lang/Nim/blob/f73e03b1323cf3ed65d6996f43c8e6891c40f924/compiler/semexprs.nim#L1203) including the magic `system.default` overload and causes a compile error if the proc doesn't match the normal use of `default`. To fix this, the `result = default(B)` initializer call is removed because it's not needed, `result` is always set in `getOrDefaultImpl` when a default value is provided. This is still a suspicious behavior of the compiler but `tables` working has a higher priority.
- Loading branch information
Showing
5 changed files
with
38 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters