gleam-lang/gleam

Qualified constants cannot be referenced inside bit array size segment patterns.

オープン

#5,607 opened on 2026/04/11

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)Rust (960 件のフォーク)batch import
good first issuehelp wanted

Repository metrics

Stars
 (21,417 個のスター)
PR merge metrics
 (平均マージ 10d 19h) (30d で 69 merged PRs)

説明

When pattern matching on a bit array, the compiler produces a syntax error if a qualified imported constant is referenced inside a size segment, for example:

import example/internal

const lap_data_size = 50

pub fn parse(bits:BitArray)->Result(_,Nil){
  case bits {
    <<
      lap_data:bytes-size(internal.maximum_cars * lap_data_size),
      time_trial_personal_best_car:unsigned-int-8,
      time_trial_rival_car:unsigned-int-8,
    >> -> todo
    _ -> todo
  }
}

This code produces the following error pointing to internal.:

Syntax error

I was not expecting this.

Found `.`, expected one of: 
- `)`

コントリビューターガイド