Purescript: Bug: Unknown qualified prefix operators render incorrect module name

Created on 28 May 2020  路  4Comments  路  Source: purescript/purescript

Description

If you reference an unknown qualified prefix operator (like Foo.Bar.Baz.(?)), the error renders with an incorrect module name (like Unknown module Baz.Bar.Foo). This happens for both type and value operators.

To Reproduce

Given a module like:

module Bug where

foo = Foo.Bar.Baz.(?)
$ purs compile Bug.purs
Compiling Bug
Error found:
in module Bug
at Bug.purs:3:7 - 3:22 (line 3, column 7 - line 3, column 22)

  Unknown module Baz.Bar.Foo


See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,
or to contribute content related to this error.


Expected behavior

The module name should be correct Foo.Bar.Baz, in this case.

Additional context

Unknown qualified infix operators (like x Foo.Bar.Baz.? y) seem to work correctly. I.e. renders as Unknown module Foo.Bar.Baz.

PureScript version

0.13.8

This seems to have worked correctly in 0.12.5, and started working incorrectly in 0.13.0 (all the 0.13.x version I tried seem to behave the same).

bug

Most helpful comment

Oh sorry, I missed the part at the end of the ticket. This is just probably related to the parser changes in 0.13. I think it's still the same issue. I had encountered lots of things that were actually stored in reverse, and then un-reversed for printing. I tried to correct this behavior and store everything in the correct order, but I probably missed some cases that were reversing for printing.

All 4 comments

That's pretty wild! :smile:

It gets even wilder!

If you reference an operator that does exist in a module (like Data.Array.(!)), and import it with purs ide, it will import the module correctly (like import Data.Array as Data.Array), but replace the reference with the incorrect module name (like Array.Data.(!)).

I think this is a knock-on from the module name being incorrect and not really something wrong with purs ide, though.

Is this recent? There was work in the previous release to flatten module names and remove the list part. Sounds like there could be cases where it's parsed as a list (reversed), and then not reversed back before rendering or something.

Oh sorry, I missed the part at the end of the ticket. This is just probably related to the parser changes in 0.13. I think it's still the same issue. I had encountered lots of things that were actually stored in reverse, and then un-reversed for printing. I tried to correct this behavior and store everything in the correct order, but I probably missed some cases that were reversing for printing.

Was this page helpful?
0 / 5 - 0 ratings