# \#compiler

**URL:** https://forum.elixirforum.com/tag/compiler/98.md

[Latest](https://forum.elixirforum.com/latest.md) · [Categories](https://forum.elixirforum.com/categories.md) · [Tags](https://forum.elixirforum.com/tags.md)

---

## [Question about macro expansion and compilation unit](https://forum.elixirforum.com/t/question-about-macro-expansion-and-compilation-unit/75265)

<div class="topic-metadata">

**Author:** [@Oliver](https://forum.elixirforum.com/u/Oliver)\
**Replies:** 5\
**Last updated:** [May 8, 2026, 10:54am UTC](https://forum.elixirforum.com/t/question-about-macro-expansion-and-compilation-unit/75265 "2026-05-08T10:54:48Z")

</div>

I have a macro that expands into a module definition. The use case is that we take a testcase defined in one elixir module (parent) and modify some parameters and generate a new module that calls parent where needed but …

---

## [Recompile\_buster - find and fix the files that cause the most recompilation](https://forum.elixirforum.com/t/recompile-buster-find-and-fix-the-files-that-cause-the-most-recompilation/74786)

<div class="topic-metadata">

**Author:** [@MrYawe](https://forum.elixirforum.com/u/MrYawe)\
**Replies:** 3\
**Last updated:** [March 30, 2026, 8:50am UTC](https://forum.elixirforum.com/t/recompile-buster-find-and-fix-the-files-that-cause-the-most-recompilation/74786 "2026-03-30T08:50:24Z")

</div>

Hey everyone! I just released recompile\_buster, a Mix task that analyzes your project’s xref graph to surface the modules whose changes trigger the most transitive recompilation. If you’ve ever changed one file and wat…

---

## [Recompile of a dependency does not take affect](https://forum.elixirforum.com/t/recompile-of-a-dependency-does-not-take-affect/74462)

<div class="topic-metadata">

**Author:** [@ken-kost](https://forum.elixirforum.com/u/ken-kost)\
**Replies:** 2\
**Last updated:** [March 1, 2026, 11:01am UTC](https://forum.elixirforum.com/t/recompile-of-a-dependency-does-not-take-affect/74462 "2026-03-01T11:01:46Z")

</div>

Something I noticed; haven’t investigated deeply but I decided to query here: Previously, when I would do a change in a dep that I was testing in a project, I could run mix compile in terminal, the dep would recompile a…

---

## [Elixir 1.19 compilation performance - have you noticed a difference?](https://forum.elixirforum.com/t/elixir-1-19-compilation-performance-have-you-noticed-a-difference/73030)

<div class="topic-metadata">

**Author:** [@marcandre](https://forum.elixirforum.com/u/marcandre)\
**Replies:** 27\
**Last updated:** [February 5, 2026, 9:10pm UTC](https://forum.elixirforum.com/t/elixir-1-19-compilation-performance-have-you-noticed-a-difference/73030 "2026-02-05T21:10:03Z")

</div>

Compilation time for our project degraded from ~26 seconds to ~32 seconds (~23% slower) :disappointed\_face:. Did anyone else compare compilation performance on their project? $ time mix compile --force && elixir -v Com…

---

## [Does the compiler optimize contructs with \`\_\` or with \`\_variable\`](https://forum.elixirforum.com/t/does-the-compiler-optimize-contructs-with-or-with-variable/73787)

<div class="topic-metadata">

**Author:** [@mszmurlo](https://forum.elixirforum.com/u/mszmurlo)\
**Replies:** 7\
**Last updated:** [December 31, 2025, 4:56pm UTC](https://forum.elixirforum.com/t/does-the-compiler-optimize-contructs-with-or-with-variable/73787 "2025-12-31T16:56:58Z")

</div>

Hi. I was wondering if the compiler makes any optimization for constructs like below. # Let’s define \`my\_func\` def my\_func(:ok, param) do some\_thing\_with(param) end def my\_func(:error, \_param) do some\_thing\_else() end …

---

## [IO.warn doesn't stop compiler with --warning-as-errors](https://forum.elixirforum.com/t/io-warn-doesnt-stop-compiler-with-warning-as-errors/73184)

<div class="topic-metadata">

**Author:** [@sezaru](https://forum.elixirforum.com/u/sezaru)\
**Replies:** 7\
**Last updated:** [November 6, 2025, 3:14pm UTC](https://forum.elixirforum.com/t/io-warn-doesnt-stop-compiler-with-warning-as-errors/73184 "2025-11-06T15:14:03Z")

</div>

In my project, I have a compile-time code that can generate some warning depending on some circumstances. To show the warning I do IO.warn(“…”). The problem is that, with this, the compiler will happily continue even i…

---

## [How to get chunks generated by the Elixir compiler?](https://forum.elixirforum.com/t/how-to-get-chunks-generated-by-the-elixir-compiler/73161)

<div class="topic-metadata">

**Author:** [@rvirding](https://forum.elixirforum.com/u/rvirding)\
**Replies:** 3\
**Last updated:** [November 3, 2025, 10:28pm UTC](https://forum.elixirforum.com/t/how-to-get-chunks-generated-by-the-elixir-compiler/73161 "2025-11-03T22:28:08Z")

</div>

I need to be able to get the Erlang AST which the Elixir compiler generates. So my question is: Is it possible to get the Elixir compiler to generate the abstract\_code chunk? I see that it generates the debug\_info chunk…

---

## [Elixir 1.19: deps only compilation](https://forum.elixirforum.com/t/elixir-1-19-deps-only-compilation/73052)

<div class="topic-metadata">

**Author:** [@cblavier](https://forum.elixirforum.com/u/cblavier)\
**Replies:** 8\
**Last updated:** [October 23, 2025, 8:03pm UTC](https://forum.elixirforum.com/t/elixir-1-19-deps-only-compilation/73052 "2025-10-23T20:03:30Z")

</div>

Hi, I’m in the process of upgrading from Elixir 1.17.x to Elixir 1.19.x. I’ve noticed that running mix loadpaths now compiles the entire application (including dependencies and application code), rather than just the de…

---

## [Suddenly the compiler takes hours to compile code that used to get compiled in seconds](https://forum.elixirforum.com/t/suddenly-the-compiler-takes-hours-to-compile-code-that-used-to-get-compiled-in-seconds/72997)

<div class="topic-metadata">

**Author:** [@mszmurlo](https://forum.elixirforum.com/u/mszmurlo)\
**Replies:** 1\
**Last updated:** [October 19, 2025, 7:26am UTC](https://forum.elixirforum.com/t/suddenly-the-compiler-takes-hours-to-compile-code-that-used-to-get-compiled-in-seconds/72997 "2025-10-19T07:26:10Z")

</div>

I’m working on a small library that, when use-ed in a client project, reads some external files and compiles those files into Elixir functions. The library has a \_\_using\_\_ macro which does the compilation of the external…

---

## [Compiling files with many function heads is very slow(OTP 26 issue?)](https://forum.elixirforum.com/t/compiling-files-with-many-function-heads-is-very-slow-otp-26-issue/57105)

<div class="topic-metadata">

**Author:** [@pejrich](https://forum.elixirforum.com/u/pejrich)\
**Replies:** 69\
**Last updated:** [October 3, 2025, 1:31pm UTC](https://forum.elixirforum.com/t/compiling-files-with-many-function-heads-is-very-slow-otp-26-issue/57105 "2025-10-03T13:31:25Z")

</div>

I have quite a few files in my project that have many function heads(100s to 1000s). I don’t think these can easily be replaced with another way of doing it. For example, transliterating Japanese into Latin characters. R…

---

## [Question about elixirc's static code analysis](https://forum.elixirforum.com/t/question-about-elixircs-static-code-analysis/72572)

<div class="topic-metadata">

**Author:** [@hannesveit](https://forum.elixirforum.com/u/hannesveit)\
**Replies:** 2\
**Last updated:** [September 18, 2025, 3:39pm UTC](https://forum.elixirforum.com/t/question-about-elixircs-static-code-analysis/72572 "2025-09-18T15:39:31Z")

</div>

Hi all, I’m trying to get up to speed with elixir and have just stumbled across a compiler warning that I find a bit puzzling. I was wondering if someone here could explain to me why the compiler behaves like this. Cons…

---

## [Reducing incremental compilation times in Phoenix/Ash project](https://forum.elixirforum.com/t/reducing-incremental-compilation-times-in-phoenix-ash-project/72113)

<div class="topic-metadata">

**Author:** [@joangavelan](https://forum.elixirforum.com/u/joangavelan)\
**Replies:** 8\
**Last updated:** [August 18, 2025, 7:38am UTC](https://forum.elixirforum.com/t/reducing-incremental-compilation-times-in-phoenix-ash-project/72113 "2025-08-18T07:38:23Z")

</div>

So I’m building a couple of projects with Elixir/Ash/Phoenix/Inertia/React and I’m being EXTREMELY productive with this stack — I mean it, VERY productive — making great progress on both projects at the same time. Altho…

---

## [What is the bullet-proof way to get notified when any module in a Phoenix application gets recompiled?](https://forum.elixirforum.com/t/what-is-the-bullet-proof-way-to-get-notified-when-any-module-in-a-phoenix-application-gets-recompiled/70738)

<div class="topic-metadata">

**Author:** [@bartblast](https://forum.elixirforum.com/u/bartblast)\
**Replies:** 10\
**Last updated:** [May 8, 2025, 8:49am UTC](https://forum.elixirforum.com/t/what-is-the-bullet-proof-way-to-get-notified-when-any-module-in-a-phoenix-application-gets-recompiled/70738 "2025-05-08T08:49:51Z")

</div>

I’m working on a bullet-proof live reload mechanism in Hologram, and I need a reliable way to be notified when any module in a Phoenix application gets recompiled and its .beam file gets updated. From my research, I’ve …

---

## [Struct instances do not share the key tuple](https://forum.elixirforum.com/t/struct-instances-do-not-share-the-key-tuple/70450)

<div class="topic-metadata">

**Author:** [@japplegame](https://forum.elixirforum.com/u/japplegame)\
**Replies:** 4\
**Last updated:** [April 14, 2025, 2:31pm UTC](https://forum.elixirforum.com/t/struct-instances-do-not-share-the-key-tuple/70450 "2025-04-14T14:31:20Z")

</div>

It appears that structures created with the %Struct{...} syntax do not share the key tuple. Compare: iex\> Enum.map(1..1000, &%URI{port: &1}) |\> :erts\_debug.size() 24000 iex(68)\> Enum.map(1..1000, &struct!(URI, port: &1…

---

## [Is this an issue with the new type checker?](https://forum.elixirforum.com/t/is-this-an-issue-with-the-new-type-checker/70367)

<div class="topic-metadata">

**Author:** [@japplegame](https://forum.elixirforum.com/u/japplegame)\
**Replies:** 2\
**Last updated:** [April 8, 2025, 8:03pm UTC](https://forum.elixirforum.com/t/is-this-an-issue-with-the-new-type-checker/70367 "2025-04-08T20:03:36Z")

</div>

Today I encountered an issue. After updating Elixir from version 1.17.3 to 1.18.3, the compilation time of my project increased dramatically (about 10 times longer). After digging through the code, I managed to reprodu…

---

## [How to get --warnings-as-errors in tests?](https://forum.elixirforum.com/t/how-to-get-warnings-as-errors-in-tests/64342)

<div class="topic-metadata">

**Author:** [@schnittchen](https://forum.elixirforum.com/u/schnittchen)\
**Replies:** 2\
**Last updated:** [January 8, 2025, 7:41pm UTC](https://forum.elixirforum.com/t/how-to-get-warnings-as-errors-in-tests/64342 "2025-01-08T19:41:50Z")

</div>

I’d like to get compiler warnings as errors in my tests, because in my experience, such warnings quite often uncover real bugs. What I’ve tried before: alias configuration in mix.exs, which exactly I forgot test\_elixi…

---

## [How is \`to\_doc/2\` imported into \`Inspect.Map\`?](https://forum.elixirforum.com/t/how-is-to-doc-2-imported-into-inspect-map/68291)

<div class="topic-metadata">

**Author:** [@lud](https://forum.elixirforum.com/u/lud)\
**Replies:** 2\
**Last updated:** [December 22, 2024, 5:36pm UTC](https://forum.elixirforum.com/t/how-is-to-doc-2-imported-into-inspect-map/68291 "2024-12-22T17:36:27Z")

</div>

If you paste the whole code from defimpl Inspect, for: Map do # ... end into an Elixir shell, you will get “undefined function color/3” and a bunch or errors for other undefined functions. I wonder how that code has a…

---

## [GitHub Actions-compatible compiler warnings/errors](https://forum.elixirforum.com/t/github-actions-compatible-compiler-warnings-errors/67719)

<div class="topic-metadata">

**Author:** [@a.shaw](https://forum.elixirforum.com/u/a.shaw)\
**Replies:** 2\
**Last updated:** [November 27, 2024, 3:26pm UTC](https://forum.elixirforum.com/t/github-actions-compatible-compiler-warnings-errors/67719 "2024-11-27T15:26:30Z")

</div>

When running Dialyzer in CI, we use the --format github option. This formats errors like: ::warning file=lib/file.ex,line=19,title=no\_return::Function fail/0 has no local return. This allows GitHub Actions to parse the…

---

## [Discovering source files using \`:filelib.wildcard/1\` is slow for large Elixir projects](https://forum.elixirforum.com/t/discovering-source-files-using-filelib-wildcard-1-is-slow-for-large-elixir-projects/67456)

<div class="topic-metadata">

**Author:** [@JohnDoneth](https://forum.elixirforum.com/u/JohnDoneth)\
**Replies:** 2\
**Last updated:** [November 12, 2024, 10:07pm UTC](https://forum.elixirforum.com/t/discovering-source-files-using-filelib-wildcard-1-is-slow-for-large-elixir-projects/67456 "2024-11-12T22:07:33Z")

</div>

The :filelib.wildcard/1 function used by the Elixir compiler for discovering Elixir source files is relatively slow for projects with a lot of files. The project I work on at the time of writing has 1570 Elixir files. Us…

---

## [Is it possible to detect if code is executing at compile time?](https://forum.elixirforum.com/t/is-it-possible-to-detect-if-code-is-executing-at-compile-time/57728)

<div class="topic-metadata">

**Author:** [@addrummond](https://forum.elixirforum.com/u/addrummond)\
**Replies:** 15\
**Last updated:** [August 27, 2024, 7:38am UTC](https://forum.elixirforum.com/t/is-it-possible-to-detect-if-code-is-executing-at-compile-time/57728 "2024-08-27T07:38:37Z")

</div>

Can Elixir code detect whether it is executing at compile time? I would like to write something like the following macro: defmacro foo() do quote do if is\_compile\_time? do one\_thing() else another\_…

---

## [Understanding how LiveView removed module references in attr as a compile time dependency](https://forum.elixirforum.com/t/understanding-how-liveview-removed-module-references-in-attr-as-a-compile-time-dependency/64889)

<div class="topic-metadata">

**Author:** [@ashkan117](https://forum.elixirforum.com/u/ashkan117)\
**Replies:** 0\
**Last updated:** [July 13, 2024, 10:23am UTC](https://forum.elixirforum.com/t/understanding-how-liveview-removed-module-references-in-attr-as-a-compile-time-dependency/64889 "2024-07-13T10:23:40Z")

</div>

I’m looking into how to reduce some compile time dependencies and stumbled across how LiveView removed its compile time dependency on Modules referred to in attrs. So something like the following is no longer a compile t…

---

## [How do I make the new type system work?](https://forum.elixirforum.com/t/how-do-i-make-the-new-type-system-work/64871)

<div class="topic-metadata">

**Author:** [@Asd](https://forum.elixirforum.com/u/Asd)\
**Replies:** 1\
**Last updated:** [July 12, 2024, 9:12am UTC](https://forum.elixirforum.com/t/how-do-i-make-the-new-type-system-work/64871 "2024-07-12T09:12:09Z")

</div>

Elixir 1.17 changelog states: At the moment, Elixir developers will interact with set-theoretic types only through warnings found by the type system I’ve compiled several old projects with Elixir 1.17 and OTP26 and I…

---

## [Inconsistency with compiler warnings upgrading to 1.17](https://forum.elixirforum.com/t/inconsistency-with-compiler-warnings-upgrading-to-1-17/64209)

<div class="topic-metadata">

**Author:** [@herman](https://forum.elixirforum.com/u/herman)\
**Replies:** 5\
**Last updated:** [June 15, 2024, 9:30am UTC](https://forum.elixirforum.com/t/inconsistency-with-compiler-warnings-upgrading-to-1-17/64209 "2024-06-15T09:30:10Z")

</div>

Hello :wave: I was working on upgrading one of our apps to 1.17 this morning and came across the compiler warning. pattern matching on 0.0 is equivalent to matching only on +0.0 from Erlang/OTP 27+ This seemed fine an…

---

## [Discrepancies with elixirc and mix compile](https://forum.elixirforum.com/t/discrepancies-with-elixirc-and-mix-compile/63301)

<div class="topic-metadata">

**Author:** [@sodapopcan](https://forum.elixirforum.com/u/sodapopcan)\
**Replies:** 1\
**Last updated:** [May 7, 2024, 5:40pm UTC](https://forum.elixirforum.com/t/discrepancies-with-elixirc-and-mix-compile/63301 "2024-05-07T17:40:09Z")

</div>

It’s come up a few times recently how the following code snippets are equivalent when compiled: def Foo do def foo do String.capitalize("foo") end end and def Foo do import String def foo do capitaliz…

---

## [Compile warning on an import that shouldn't be called](https://forum.elixirforum.com/t/compile-warning-on-an-import-that-shouldnt-be-called/63279)

<div class="topic-metadata">

**Author:** [@xlive](https://forum.elixirforum.com/u/xlive)\
**Replies:** 0\
**Last updated:** [May 2, 2024, 10:26am UTC](https://forum.elixirforum.com/t/compile-warning-on-an-import-that-shouldnt-be-called/63279 "2024-05-02T10:26:42Z")

</div>

Hello there! :wave: This should be quite a straightforward question for those who have more knowledge about how Elixir compiles our files :eyes: I have a module where I want to compile (or not) some imports depending o…

---

## [Guard clause on match operator](https://forum.elixirforum.com/t/guard-clause-on-match-operator/62981)

<div class="topic-metadata">

**Author:** [@giddie](https://forum.elixirforum.com/u/giddie)\
**Replies:** 25\
**Last updated:** [April 24, 2024, 3:21pm UTC](https://forum.elixirforum.com/t/guard-clause-on-match-operator/62981 "2024-04-24T15:21:46Z")

</div>

I came across this blog post (linked from Elixir Radar) about implementing a match operator that supports guard clauses. And it reminded me that this is a minor annoyance that I come across fairly frequently. For instan…

---

## [Catching @doc deprecated: "..." annotations](https://forum.elixirforum.com/t/catching-doc-deprecated-annotations/62396)

<div class="topic-metadata">

**Author:** [@arjan](https://forum.elixirforum.com/u/arjan)\
**Replies:** 5\
**Last updated:** [March 20, 2024, 10:36am UTC](https://forum.elixirforum.com/t/catching-doc-deprecated-annotations/62396 "2024-03-20T10:36:00Z")

</div>

I am trying to hook into the @doc deprecated: "message" annotation using \_\_on\_definition\_\_. defmodule ExampleCompiler do def \_\_on\_definition\_\_(env, \_, fun, \_, \_, \_) do doc = Module.get\_attribute(env.module, :doc) …

---

## [Trouble understanding a warning: incompatible types](https://forum.elixirforum.com/t/trouble-understanding-a-warning-incompatible-types/61597)

<div class="topic-metadata">

**Author:** [@dwark](https://forum.elixirforum.com/u/dwark)\
**Replies:** 3\
**Last updated:** [February 12, 2024, 6:22am UTC](https://forum.elixirforum.com/t/trouble-understanding-a-warning-incompatible-types/61597 "2024-02-12T06:22:32Z")

</div>

The following code results in a warning that is difficult for me to understand: defmodule Mod do def hello(name) do map = Map.new(words: \["world"\]) IO.inspect(length(map.words), label: :before) map = %{ma…

---

## [Getting rid of a transitive compile dependency with custom Ecto type](https://forum.elixirforum.com/t/getting-rid-of-a-transitive-compile-dependency-with-custom-ecto-type/60555)

<div class="topic-metadata">

**Author:** [@gmile](https://forum.elixirforum.com/u/gmile)\
**Replies:** 3\
**Last updated:** [January 6, 2024, 9:05am UTC](https://forum.elixirforum.com/t/getting-rid-of-a-transitive-compile-dependency-with-custom-ecto-type/60555 "2024-01-06T09:05:56Z")

</div>

Hi! I’m continuing my battle (1, 2) against transitive compile-time dependencies on a large code base :slight\_smile: This time I am facing an issue with getting rid of a comp. time dependency coming from a custom Ecto t…

---

## [Advice to avoid simple transitive compile-time dependency](https://forum.elixirforum.com/t/advice-to-avoid-simple-transitive-compile-time-dependency/60528)

<div class="topic-metadata">

**Author:** [@gmile](https://forum.elixirforum.com/u/gmile)\
**Replies:** 8\
**Last updated:** [December 23, 2023, 4:31pm UTC](https://forum.elixirforum.com/t/advice-to-avoid-simple-transitive-compile-time-dependency/60528 "2023-12-23T16:31:05Z")

</div>

I am trying to understand why transitive compile-time dependency is there, and what’s a good strategy to remove it. The mix app for example below is available here. In a nutshell, I have these 3 modules: # a.ex defmodu…

[Next page](https://forum.elixirforum.com/tag/compiler/98.md?match_all_tags=true&page=1&tags%5B%5D=compiler)
