lifting from within user-defined macros can break compilation
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Beginne damit, den Example Input auf main zu reproduzieren, und untersuche, wie styler aliases durch verschachtelte do-blocks hebt und quote children behandelt. Vergleiche die beiden vorgeschlagenen Fixes und verifiziere anschließend, dass Code mit einem benutzerdefinierten Makro weiterhin kompiliert wird, ohne einen unbenutzten äußeren Alias oder einen undefinierten Namen innerhalb des Makros.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Versions
currently on main, but 0.12 when it gets cut
Example Input
lifting is smart enough to not interact with quote children, but user-defined macros can hide that that's occurring.
defmodule Foo do
@moduledoc false
my_quote do
alias AliasFor.In.MyQuote
... Foo.Bar.Baz...
... Foo.Bar.Baz ...
end
end
results in:
defmodule Foo do
@moduledoc false
alias Foo.Bar.Baz
my_quote do
alias AliasFor.In.MyQuote
... Baz...
... Baz ...
end
end
but as with quote, the compiler will warn that Baz is unused within Foo, and anything that uses my_quote will then error on Baz being undefined
as-is, the user will have to put the alias where it belongs inside my_quote, which styler is just fine with and will leave be. still, i'd like styler to not leave a codebase uncompilable, even if it just requires a simple human fix
Fix
I see two possible
- never go into do blocks of unknown parents looking for liftable aliases (allowlist all kernel forms and nothing else)
- when a do-block contains a module directive, assume that it's equivalent to a
quoteblock and back out of it
there are pros and cons to each, but 2 probably gives the more correct result, with the downside being a more complex look-ahead implementation. actually, the real win might be doing a combination of both: when encounter directives in a nested scope, figure out if it's a known block parent. if it is, carry on. if it's not, assume this works as a quote does and don't lift
- Vorherrschende Sprache
- Elixir
- Sterne
- 810
- Forks
- 46
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Ähnliche Issues
-
Good first issue: add elixir-phoenix-liveview stack budget preset (Elixir + Phoenix 1.8 + LiveView)Offenenhancement good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
elixir priority-2 T5m technical user-feedback
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 76/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
wanderer-industries/wanderer#687 ·
-
Add Holistic Mentorship Dictation Usage Records table (af_lms#500)Evtl. vergeben @deepansh96 hat das vor 1 Tag übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
avantifellows/db-service#857 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 79/100
FarmBot/farmbot_os#1530 ·