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

List comprehension stops compiler from producing an expected error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 21.2, 22.0.4
    • Fix Version/s: 22.2
    • Component/s: compiler
    • Labels:
      None

      Description

      Affects multiple versions, so it's not a freshly introduced R22 bug.

      Minimal code example (uncomment "ok" line to get the expected behaviour):
      (expected error is : "test.erl:21: variable 'P' unsafe in 'case' (line 8)")

      -module(test).
      -author("dane").

      %% API

      main() ->
      case node() of
      P when is_tuple(P) ->
      P;
      _ ->
      ok
      end,
      Y = try
      ok
      catch _C:_R ->
      [1 || _ <- [] ] %% when this is uncommented, no compile error produced
      %ok %% uncomment this to produce expected error
      end,
      case Y of
      P ->
      P
      end.

        Attachments

          Activity

            People

            Assignee:
            john John Högberg
            Reporter:
            dane Maxim Fedorov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: