Skip to content

Cannot inject attribute because it contains a reference #7

@cmdrk

Description

@cmdrk

Hello! I really like your project!

I'm getting a compilation error as follows when trying to build it:


     warning: storing and reading regexes from module attributes is deprecated, inline the regex inside the function definition instead
     │
 855 │     case Regex.run(@timestamp_pattern, line) do
     │     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     │
     └─ lib/term_ui/widgets/log_viewer.ex:855: TermUI.Widgets.LogViewer.extract_timestamp/1


== Compilation error in file lib/term_ui/widgets/log_viewer.ex ==
** (ArgumentError) cannot inject attribute @level_patterns into function/macro because ~r/\b(EMERGENCY|EMERG)\b/i contains a reference (#Reference<0.542768475.64618511.175429>) and therefore it cannot be escaped (it must be defined within a function instead). The supported values are: lists, tuples, maps, atoms, numbers, bitstrings, PIDs and remote functions in the format &Mod.fun/arity
    (elixir 1.19.0-rc.0) lib/kernel.ex:3878: Kernel.do_at_escape/2
    (elixir 1.19.0-rc.0) expanding macro: Kernel.@/1
    lib/term_ui/widgets/log_viewer.ex:868: TermUI.Widgets.LogViewer.extract_level/1

Environment

Elixir 1.19.0
Erlang/OTP 28
FreeBSD 14.2

Steps to reproduce

git clone https://github.com/pcharbon70/term_ui
cd term_ui
mix deps.get
mix compile

Any idea what I might need to do to get it going? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions