Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-1178

Wrong location reported for badarith error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 22.1
    • Fix Version/s: OTP-23.0
    • Component/s: compiler
    • Labels:
      None

      Description

      Given the following test.erl file:

      -module(test).
      
      -export([test/0]).
      
      test() ->
          A = maps:find(v, #{}),
          10 / A.

      calling test:test() results in:

      ** exception error: an error occurred when evaluating an arithmetic expression
           in function  test:test/0 (test.erl, line 6)

      The error is reported on line 6, while it should be reported on line 7, given the division is happening on line 7.

       

      Originally reported in https://github.com/elixir-lang/elixir/issues/9833

        Attachments

          Activity

            People

            Assignee:
            john John Högberg
            Reporter:
            michalmuskala Michał Muskała
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: