Open pdtwonotes opened 5 years ago
Thanks for reporting this. Could you print both the ast
and type
variables when you reached the segfault in the debugger with: p ast_print(ast, 80)
p ast_print(type, 80)
and paste them here?
That would be mighty helpful.
(lldb) p ast_print(ast,80)
(try
(seq:scope
(call
(funref
(letref (id $2$0) [nominal (id $3) (id BRPairIterator) x ref x x])
(id next)
[funtype
ref
x
x
(tupletype
(uniontype
(nominal (id $0) (id U8) x val x x)
(nominal (id $0) (id U16) x val x x)
(nominal (id $0) (id U32) x val x x)
(nominal (id $0) (id USize) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal
(id $0)
(id Array)
(typeargs (nominal (id $0) (id U8) x val x x))
val
x
x
)
(nominal (id $0) (id None) x val x x)
)
(uniontype
(nominal (id $0) (id U8) x val x x)
(nominal (id $0) (id U16) x val x x)
(nominal (id $0) (id U32) x val x x)
(nominal (id $0) (id USize) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal
(id $0)
(id Array)
(typeargs (nominal (id $0) (id U8) x val x x))
val
x
x
)
(nominal (id $0) (id None) x val x x)
)
)
]
)
x
x
?
[tupletype
(uniontype
(nominal (id $0) (id U8) x val x x)
(nominal (id $0) (id U16) x val x x)
(nominal (id $0) (id U32) x val x x)
(nominal (id $0) (id USize) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal
(id $0)
(id Array)
(typeargs (nominal (id $0) (id U8) x val x x))
val
x
x
)
(nominal (id $0) (id None) x val x x)
)
(uniontype
(nominal (id $0) (id U8) x val x x)
(nominal (id $0) (id U16) x val x x)
(nominal (id $0) (id U32) x val x x)
(nominal (id $0) (id USize) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal
(id $0)
(id Array)
(typeargs (nominal (id $0) (id U8) x val x x))
val
x
x
)
(nominal (id $0) (id None) x val x x)
)
]
)
[tupletype
(uniontype
(nominal (id $0) (id U8) x val x x)
(nominal (id $0) (id U16) x val x x)
(nominal (id $0) (id U32) x val x x)
(nominal (id $0) (id USize) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal
(id $0)
(id Array)
(typeargs (nominal (id $0) (id U8) x val x x))
val
x
x
)
(nominal (id $0) (id None) x val x x)
)
(uniontype
(nominal (id $0) (id U8) x val x x)
(nominal (id $0) (id U16) x val x x)
(nominal (id $0) (id U32) x val x x)
(nominal (id $0) (id USize) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal
(id $0)
(id Array)
(typeargs (nominal (id $0) (id U8) x val x x))
val
x
x
)
(nominal (id $0) (id None) x val x x)
)
]
)
(seq:scope (break x))
(seq:scope
(call
(newref
(typeref x (id None) x [nominal (id $0) (id None) x val x x])
(id create)
[funtype val x x (nominal (id $0) (id None) x val ^ x)]
)
x
x
x
[nominal (id $0) (id None) x val ^ x]
)
[nominal (id $0) (id None) x val ^ x]
)
[tupletype
(uniontype
(nominal (id $0) (id U8) x val x x)
(nominal (id $0) (id U16) x val x x)
(nominal (id $0) (id U32) x val x x)
(nominal (id $0) (id USize) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal
(id $0)
(id Array)
(typeargs (nominal (id $0) (id U8) x val x x))
val
x
x
)
(nominal (id $0) (id None) x val x x)
)
(uniontype
(nominal (id $0) (id U8) x val x x)
(nominal (id $0) (id U16) x val x x)
(nominal (id $0) (id U32) x val x x)
(nominal (id $0) (id USize) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal
(id $0)
(id Array)
(typeargs (nominal (id $0) (id U8) x val x x))
val
x
x
)
(nominal (id $0) (id None) x val x x)
)
]
)
(lldb) p ast_print(type,80)
(tupletype
(uniontype
(nominal (id $0) (id U8) x val x x)
(nominal (id $0) (id U16) x val x x)
(nominal (id $0) (id U32) x val x x)
(nominal (id $0) (id USize) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal
(id $0)
(id Array)
(typeargs (nominal (id $0) (id U8) x val x x))
val
x
x
)
(nominal (id $0) (id None) x val x x)
)
(uniontype
(nominal (id $0) (id U8) x val x x)
(nominal (id $0) (id U16) x val x x)
(nominal (id $0) (id U32) x val x x)
(nominal (id $0) (id USize) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal (id $0) (id String) x val x x)
(nominal
(id $0)
(id Array)
(typeargs (nominal (id $0) (id U8) x val x x))
val
x
x
)
(nominal (id $0) (id None) x val x x)
)
)
I suspect that this might be because I have a union type that contains both String and ByteSeq. And ByteSeq itself is a union type containing String and Array[U8]. This results in two copies of String in my union type. When I change my code to not have both String and ByteSeq, the segment violation goes away. Perhaps this case needs to be caught before getting to code generation with the usual helpful error message.
Compliling a rather complex program gets this fault. I need help in narrowing down which piece of source code is triggering it.