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

SRTP type class pattern results in duplicate bindings in same scope #3921

Open
joprice opened this issue Oct 8, 2024 · 0 comments
Open

SRTP type class pattern results in duplicate bindings in same scope #3921

joprice opened this issue Oct 8, 2024 · 0 comments

Comments

@joprice
Copy link
Contributor

joprice commented Oct 8, 2024

Description

When using STRP in a style as is used in FSharPlus, where members can be looked up from a typeclass definition or an specific type, some inlined functions end up generating duplicated functions in the same scope. This results in code with syntax errors such as Uncaught SyntaxError: Identifier 'x_1' has already been declared.

The code to reproduce this is quite convoluted, involving a "typeclass", a container type, and resolution of two instances of the "typeclass". The two inlined resolutions ends up occupying the same scope and any local bindings result in duplicated bindings in the final scope.

Repro code

https://fable.io/repl/#?code=C4TwDgpgBAwg9gEwgYwDwHICGA+KBeKAH1kRQCgyopRISlkBnfSq1gejak2CgBsJMDHsADucKHABuEAE684mBE0wzoqgI4BXAJaqEUABazowcZklxt+zAFsARtoDmO0C1ZQh3bcig2I92ShtADteEOh4egYACgB9OE1gMESALiDg4AAaKFibYAMENMiUBgBKKCLSNBDgXAJi5DdWT2BvX387QJCw4IiqmPjE5OA0uzg4Xmzc-MK6EvLK+lQxibq5xop3Kha2vwCZdJ7oAElgiwBrCGjyvCatvggebvCoZExeXliAJihozDSAHqYbJ2QF2G53e6saLRIESA4A8FpaI7Hx7ToHBoMNKxKAAKhyUAAtLhYuU7NlMKVNlCqPwnqEXm8Pr9-lAsBDafdmZ8fn9sgBVYLIIzIS4IAB0SAAZphNLxTNKMDJsKVFihldgabSeVAhSKUOKpRBZfLFagsVqWDQ+lEoCJtPlIaj2vtDi8sagoEDsojIe4REZgr8gWrfi70YFkFVTr0ZOq0N67FBcCT1l64ar-axMMF9NEsfCk2GUcAvGiOoEsWD8esmGmGhnk6qtVzfoMkqlvcCcnkCgmytmqAmM5gU8w2xxqAZtEwjlBHI8mM9evoHfkEjwGNHaAZcwgeo5fsckBltNLtIF0AAPWIARnQhkEXF4qkUICgnQgwfovBUEAQak23pKBr3wKA7yHdlMAlaN6FjQIC36CVTguK5SmpFgQJXaBF2ARssHtINfkLOAESpZEI0rTF+kBMcCULBsqlHFNSlwa4KnTbtx1ue4QLZAicHArEULOOBLmuSFMBpbDGV6BdHk9LBsnQOxIUDb8SP6ItQ0ostWgrN1q24hjtKYpZuKze59y0u0yOLPTy1dDE6xrUy7XMjUk1Y1stkk+4R0s2tG28upIX4kcsDWETUPE9DwseT9IrsaLkNiiSgL8ntwRpG0SAyTBwhkDAABUwvuYh4AKortWafTdmo14Y2CONSpUgBRbBohGdN0DKhZ0yqssitK7Byq5ECPwISC2waGkpwYEJHH4Jrqrje0yPOBgsMS2IRyGwrWpqMbwLwhpfkwqgpzAQqZCYMQZHOHaeD22yNWO4LmOOm4FPw7TJJYKcxxu3QJGlVbhrjJgEHEYI4B4IkFLjbgIGhzQwF4ZBtBRpqkHSKAkDsTQjxsUhAc4ABlEACuvdqZBkMi0hPb9WgvK9bwfJ9lFfAQEA-L8fxQP89GenJkUbA6RuO3B3I1SWjoyMafrO-7SiAA&html=Q&css=Q

Expected and actual results

Please provide the expected and actual results.

Related information

  • Fable version: 4.22.0
  • Operating system OSX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant