Skip to content

Conversation

@kevinschweikert
Copy link
Contributor

> mix compile
Compiling 1 file (.ex)
     warning: a struct for Lua is expected on struct update:

         %Lua{lua | state: new_state}

     but got type:

         dynamic()

     where "lua" was given the type:

         # type: dynamic()
         # from: lib/lua.ex:409:18
         {chunk, lua} = load_chunk!(lua, chunk)

     when defining the variable "lua", you must also pattern match on "%Lua{}".

     hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of:

         user = some_fun()
         %User{user | name: "John Doe"}

     it is enough to write:

         %User{} = user = some_fun()
         %{user | name: "John Doe"}

     typing violation found at:
     │
 413 │         lua = %__MODULE__{lua | state: new_state}
     │               ~
     │
     └─ lib/lua.ex:413:15: Lua.eval!/3

@davydog187 davydog187 merged commit 8011fe7 into tv-labs:main Oct 17, 2025
2 checks passed
@davydog187
Copy link
Contributor

🍍 🍍 🍍 🍍 🍍

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

Successfully merging this pull request may close these issues.

2 participants