Skip to content

Improve Error Call Signature#32

Merged
selenil merged 1 commit intoselenil:mainfrom
DynamicCake:refactor/error-call
Mar 15, 2026
Merged

Improve Error Call Signature#32
selenil merged 1 commit intoselenil:mainfrom
DynamicCake:refactor/error-call

Conversation

@DynamicCake
Copy link
Contributor

No description provided.

@DynamicCake DynamicCake changed the title Improve error cal Improve error call Mar 4, 2026
@DynamicCake DynamicCake force-pushed the refactor/error-call branch from 43b6234 to d35f506 Compare March 14, 2026 21:08
@DynamicCake DynamicCake changed the title Improve error call Improve Error Call Signature Mar 15, 2026
@DynamicCake
Copy link
Contributor Author

DynamicCake commented Mar 15, 2026

I made this PR to make the usage of error_call in functions not super annoying.

For example

 pub fn error_example() {
  glua.function(fn(params) {
    use num <- glua.then(case params {
      [] -> glua.error("Expected one number")
      [num, ..] -> glua.dereference(num, decode.int) // here
    })
    // ...
    todo
  })
}

leads to a

Type mismatch
   
   This case clause was found to return a different type than the previous
   one, but all case clauses must return the same type.
   
   Expected type:
   
       glua.Action(List(glua.Value), glua.Never)
   
   Found type:
   
       glua.Action(Int, a)

Also, the List(glua.Value) in glua.Action(List(glua.Value), glua.Never) never gets reached

@selenil selenil merged commit 035f7ad into selenil:main Mar 15, 2026
1 check passed
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