Skip to content

ICE: ^-char in match using regex crashes compiler #925

@tx46

Description

@tx46

Code

  • Target: js (maybe irrelevant)
pub fn Env::is_valid_var_name(var_name : String) -> Bool {
  match var_name.to_bytes() using regex {
    ["^[A-Z_][A-Z0-9_]*"] => true
    _ => false
  }
}

The initial hat (^) in the regex causes the ICE.

Environment

  • OS: Linux
  • OS distribution and/or version: Void
  • CPU Architecture: x86_6
moon 0.1.20250724 (2797252 2025-07-24) ~/.moon/bin/moon
moonc v0.6.22 ~/.moon/bin/moonc
moonrun 0.1.20250724 (2797252 2025-07-24) ~/.moon/bin/moonrun

Error output

Oops, the compiler has encountered an unexpected situation.
This is a bug in the compiler.

A bug report containing the error description and relevant code would be
greatly appreciated. You can submit the bug report here:

  https://github.com/moonbitlang/moonbit-docs/issues/new?template=ice.md

Error: File "moonc.ml", line 241426, characters 28-34: Assertion failed

Metadata

Metadata

Assignees

Labels

ICEInternal Compiler ErrorbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions