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

happy-2.0.2 regresses language-python-0.5.8 #316

Closed
bgamari opened this issue Sep 27, 2024 · 9 comments
Closed

happy-2.0.2 regresses language-python-0.5.8 #316

bgamari opened this issue Sep 27, 2024 · 9 comments

Comments

@bgamari
Copy link
Contributor

bgamari commented Sep 27, 2024

dist/build/Language/Python/Version2/Parser/Parser.hs:7426:4: error: [GHC-83865]
    • Couldn't match type ‘Happy_GHC_Exts.Int32#’
                     with ‘Happy_GHC_Exts.Int#’
      Expected: Happy_Int
        Actual: Happy_GHC_Exts.Int32#
    • In the expression: Happy_GHC_Exts.indexInt32OffAddr# arr off
      In an equation for ‘happyIndexOffAddr’:
          happyIndexOffAddr (HappyA# arr) off
            = (Happy_GHC_Exts.indexInt32OffAddr# arr off)
     |
7426 |   (Happy_GHC_Exts.indexInt32OffAddr# arr off)
     |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Using GHC 9.6.5.

@Ericson2314
Copy link
Collaborator

Huh that looks like an older bug that happened when the GHC unboxed number one was changing. I didn't think anything happened relative this since the last 1.x release.

@bgamari
Copy link
Contributor Author

bgamari commented Sep 27, 2024

I can confirm that the same project builds with happy-1.20.1.1.

@Ericson2314
Copy link
Collaborator

@bgamari Can you diff the generated parsers?

@bgamari
Copy link
Contributor Author

bgamari commented Sep 27, 2024

@sgraf812
Copy link
Collaborator

Very strange. It must be this line from the template:

(Happy_GHC_Exts.indexInt32OffAddr# arr off)

But we test this code path quite extensively on GHC 9.6 and lower. Is there anything special about the architecture? 32 bit?

(The diff appears to be incomplete, btw. Not that it matters.)

@Bodigrim
Copy link

That's because of https://github.com/bjpop/language-python/blob/8e0a43ddfd1b9e22d104ece01333706d0fe71e04/language-python/src/Language/Python/Version2/Parser/Parser.y#L4-L5

#undef __GLASGOW_HASKELL__
#define __GLASGOW_HASKELL__ 709

@Bodigrim
Copy link

I've seen this ugly hack used in the wild more than once to work around #109. For this particular instance see discussion at bjpop/language-python#41.

Instead of #if __GLASGOW_HASKELL__ >= 901 we can check #if MIN_VERSION_base(4,15,0), which is equivalent, but immune to #undef __GLASGOW_HASKELL__.

@bgamari
Copy link
Contributor Author

bgamari commented Sep 27, 2024

Oof, that is awful. Good catch, @Bodigrim .

@bgamari bgamari closed this as completed Sep 27, 2024
@Ericson2314
Copy link
Collaborator

OK whew, I am glad this wasn't a crazy bug in happy itself :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants