-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiler segfaults on lambda sugar (nim 1.6.16) #22820
Comments
Can you provide a reduced assertive source code repro sample ?. |
@juancarlospaco Sorry, I was trying to make minimal working example, but was unable to. But I can assist you with the codebase where this bug is reproducible. |
Repro:
{.push raises: [].}
import
"."/[node]
import
std/[options, sugar]
var closestNodes: seq[Node]
for cn in closestNodes:
discard cn.address.map(a => a.port)
import std/options
type
Address* = object
port*: int
Node* = ref object
address*: Option[Address] On 1.6 (any version I tried, up to current
2.0 and devel don't seem to have this problem. Example Nim versions: SIGSEGV upon compilation:
No SIGSEGV:
|
closes nim-lang#6013, closes nim-lang#7009, closes nim-lang#9190, closes nim-lang#12487, closes nim-lang#12831, closes nim-lang#13184, closes nim-lang#13252, closes nim-lang#14860, closes nim-lang#14877, closes nim-lang#14894, closes nim-lang#14917, closes nim-lang#16153, closes nim-lang#16439, closes nim-lang#17779, closes nim-lang#18074, closes nim-lang#18202, closes nim-lang#18314, closes nim-lang#18648, closes nim-lang#19063, closes nim-lang#19446, closes nim-lang#20065, closes nim-lang#20367, closes nim-lang#22126, closes nim-lang#22820, closes nim-lang#22888, closes nim-lang#23020, closes nim-lang#23287, closes nim-lang#23510
Description
I've been trying to use some functional style programming to access type lifted into
Option
.If you re-arrange this code differently i.e. move
map((a) => $a.port).get("0")
part into separate proc this issue goes away. Which makes me think it is somehow connected to type inference.To replicate this:
Nim Version
Nim Compiler Version 1.6.16 [MacOSX: arm64]
Compiled at 2023-10-12
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: 3c9b68d
active boot switches: -d:release
Current Output
Expected Output
No response
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: