Skip to content
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 crash with ambiguous function call #1405

Open
starsiderfox opened this issue Aug 8, 2024 · 1 comment
Open

Compiler crash with ambiguous function call #1405

starsiderfox opened this issue Aug 8, 2024 · 1 comment
Labels
bug Something isn't working compiler/sem Related to semantic-analysis system of the compiler

Comments

@starsiderfox
Copy link
Contributor

Specification

The compiler crashes when a proc is called with a parameter of ambiguous type.

Example

proc f(x: seq[int]|seq[float]) = discard
f @[]

Actual Output

nim.nim                  nim
nim.nim                  handleCmdLine
main.nim                 mainCommand
main.nim                 compileToBackend
main.nim                 commandCompileToC
cbackend.nim             generateCode
cbackend.nim             generateCode
backends.nim             translate
mirgen.nim               generateCode
mirgen.nim               gen
mirgen.nim               gen
mirgen.nim               genCallOrMagic
mirgen.nim               genCall
mirgen.nim               genArgs
mirgen.nim               genArg
mirgen.nim               emitOperandTree
mirgen.nim               genArgExpression
mirgen.nim               genx
mirgen.nim               typeToMir
mirtypes.nim             add
mirtypes.nim             handleImported
mirtypes.nim             typeSymToMir
mirtypes.nim             typeToMir
mirtypes.nim             add
mirtypes.nim             handleImported
mirtypes.nim             typeSymToMir
mirtypes.nim             typeToMir
idioms.nim               unreachableImpl
idioms.nim               unreachableImpl
assertions.nim           raiseAssert
fatal.nim                sysFatal
Error: unhandled exception: mirtypes.nim(885, 16) unreachable: tyEmpty [AssertionDefect]

Expected Output

Maybe some error message that at least explains where the problem occurs. Although personally I would prefer that the first compatible type is selected automatically.

Additional Information

nim_dbg doesn't show any location data.

@starsiderfox starsiderfox added the bug Something isn't working label Aug 8, 2024
@saem
Copy link
Collaborator

saem commented Aug 8, 2024

Maybe some error message that at least explains where the problem occurs. Although personally I would prefer that the first compatible type is selected automatically.

If it's ambiguous then it has to be an error, silently succeeding is far worse.

@zerbina zerbina added the compiler/sem Related to semantic-analysis system of the compiler label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler/sem Related to semantic-analysis system of the compiler
Projects
None yet
Development

No branches or pull requests

3 participants