You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
barbies-th works fine with DuplicateRecordFields enabled (thanks to the name unmangling patches); but it can't handle record fields that are actually duplicated. Possibly this is an accepted limitation, but it would be nice to document it I think. The error message is not very friendly:
... Assembler messages: ... Error: symbol `testlibzm0zi1zi0zi0zminplace_Lib_qux_info' is already defined ... testlibzm0zi1zi0zi0zminplace_Lib_qux_info
@Elvecent reported this as well, at the bottom of the thread in #3.
peter@gtower:~/2022october8_reproduce_barbies_error$ cabal build
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- testlib-0.1.0.0 (lib) (first run)
Preprocessing library for testlib-0.1.0.0..
Building library for testlib-0.1.0.0..
[1 of 1] Compiling Lib ( src/Lib.hs, /home/peter/2022october8_reproduce_barbies_error/dist-newstyle/build/x86_64-linux/ghc-8.10.7/testlib-0.1.0.0/build/Lib.o, /home/peter/2022october8_reproduce_barbies_error/dist-newstyle/build/x86_64-linux/ghc-8.10.7/testlib-0.1.0.0/build/Lib.dyn_o )
/tmp/ghc80775_0/ghc_2.s: Assembler messages:
/tmp/ghc80775_0/ghc_2.s:1298:0: error:
Error: symbol `testlibzm0zi1zi0zi0zminplace_Lib_qux_info' is already defined |1298 | testlibzm0zi1zi0zi0zminplace_Lib_qux_info: | ^/tmp/ghc80775_0/ghc_2.s:1329:0: error: Error: symbol `testlibzm0zi1zi0zi0zminplace_Lib_qux_closure' is already defined|1329 | testlibzm0zi1zi0zi0zminplace_Lib_qux_closure:| ^`gcc' failed in phase `Assembler'. (Exit code: 1)
I tried to minimize the testcase further by expanding the splices and minimizing the generated code, but I was unable to achieve further minimization. I expanded one splice using the code-action offered by HLS. I found that the generated code is referencing a symbol called (Unit :: (Type -> Constraint) -> Type -> Constraint). I stubbed out such a type like this:
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE UndecidableSuperClasses #-}
importData.Kind (Constraint, Type)
classct=>Unit (c::Type->Constraint) (t::Type) where{- empty body -}
When I added that bit, the generated code started compiling. That is, without the "symbol already defined" error.
Thanks for the library, seems cool.
The text was updated successfully, but these errors were encountered:
Thank you for reporting this, I was able to reproduce this on GHC 9.2.4 too. That's a shame... This looks like a GHC bug because such error messages are most likely not intended to be shown to users.
barbies-th works fine with DuplicateRecordFields enabled (thanks to the name unmangling patches); but it can't handle record fields that are actually duplicated. Possibly this is an accepted limitation, but it would be nice to document it I think. The error message is not very friendly:
... Assembler messages: ... Error: symbol `testlibzm0zi1zi0zi0zminplace_Lib_qux_info' is already defined ... testlibzm0zi1zi0zi0zminplace_Lib_qux_info
@Elvecent reported this as well, at the bottom of the thread in #3.
GHC 8.10.7
barbies == 2.0.3.1
barbies-th == 0.1.10
Example:
I tried to minimize the testcase further by expanding the splices and minimizing the generated code, but I was unable to achieve further minimization. I expanded one splice using the code-action offered by HLS. I found that the generated code is referencing a symbol called (Unit :: (Type -> Constraint) -> Type -> Constraint). I stubbed out such a type like this:
When I added that bit, the generated code started compiling. That is, without the "symbol already defined" error.
Thanks for the library, seems cool.
The text was updated successfully, but these errors were encountered: