Skip to content

Compiler crash with ambiguous function call #1405

Open
@starsiderfox

Description

@starsiderfox

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompiler/semRelated to semantic-analysis system of the compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions