InternalCompilerException: Expr.Binary operator not recognized when a math-name operator is used infix
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- compilers
調査の方向性
Weeder2.visitBinaryExprから始めます。issueによると、ここではNameMathが内部エラーに至ります。このケースを既存のGenericOperatorの処理および#13326にある#13320の修正と比較してください。a ⊆ bと、提示されたユーザー定義演算子の例で再現し、その後、どちらも内部エラーではなく期待される適用または診断を生成することを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Summary
Using a math-name operator such as ⊆ in infix position makes the compiler throw InternalCompilerException: Expr.Binary operator not recognized. The parser accepts the expression (Parser2 treats NameMath as a binary operator, with the precedence of UserDefinedOperator), but Weeder2.visitBinaryExpr has no case for the NameMath token and falls through to the final throw.
This is the same exception as in #13320, which was fixed for a keyword between backticks (#13326). The input below is a different trigger and still crashes.
Minimal reproduction
Create Hello.flix:
def f(a: Bool, b: Bool): Bool = a ⊆ b
Run:
java -jar flix.jar --version
java -jar flix.jar check Hello.flix
echo "exit $?"
Actual behavior
Output (first lines; Flix 0.79.0, 0.80.0 and a master build at 2f6ce4aff157071d4f88ab9361b5887c920b2551 print the same message):
#
# An unexpected error has been detected by the Flix compiler:
#
# Expr.Binary operator not recognized (Hello.flix:1:33)
#
The compiler exits with code 1 and writes crash_report_0.txt. The exception is thrown at Weeder2$Exprs$.visitBinaryExpr. a ∪ b behaves the same.
The same happens for a user-defined operator that is defined and used:
def ⊆(x: Bool, y: Bool): Bool = x and y
def main(): Bool = true ⊆ false
#
# An unexpected error has been detected by the Flix compiler:
#
# Expr.Binary operator not recognized (Hello.flix:3:20)
#
Expected behavior
A diagnostic instead of an internal error, or an application of the function named ⊆ (as for GenericOperator, which visitBinaryExpr turns into Expr.Apply(Expr.Ambiguous(...))).
Environment
- Flix 0.80.0 (
java -jar flix.jar --version:The Flix Programming Language 0.80.0), master 2f6ce4aff157071d4f88ab9361b5887c920b2551, 0.79.0 - JDK: Eclipse Temurin 21.0.13+9
- OS: Linux 7.2.12, aarch64
- 主要言語
- Flix
- スター
- 2.7k
- フォーク
- 194
- 平均マージ
- 10時間 7分
- マージ済み PR(30日)
- 170
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
flix/flix のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
flix/flix#9715 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
DAE2 crashes on call.without.effects with a non ref.func expression対応中かも @stevenfontanella が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
WebAssembly/binaryen#9404 ·
メンテナーはふだん 1 日以内に返信
-
area:compiler effort:S impact:med platform:windows type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
area:Analysis enhancement
難易度 1/5 1〜3時間 初心者へのやさしさ 69/100
facebookresearch/atlas-lean#5118 ·
メンテナーはふだん 1 日以内に返信
-
bug css P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
fizzbee-io/fizzbee#478 ·
メンテナーはふだん 1 日以内に返信