Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit973351a

Browse files
authored
Fix crash when using bitwise not on incompatible type (#7965)
* Fix crash when using bitwise not on incompatible type* CHANGELOG* Fix comments
1 parent9616716 commit973351a

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
- Fix: use configured Jsx module for constraining component return type.https://github.com/rescript-lang/rescript/pull/7945
2626
- Undeprecate`Js_OO` module since it is still used with the`@this` attribute.https://github.com/rescript-lang/rescript/pull/7955
27+
- Fix crash when using bitwise not on incompatible type.https://github.com/rescript-lang/rescript/pull/7965
2728

2829
####:memo: Documentation
2930

‎compiler/ml/typecore.ml‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3453,9 +3453,14 @@ and translate_unified_ops (env : Env.t) (funct : Typedtree.expression)
34533453
|Tconstr (path, _, _), {string=Some _}
34543454
whenPath.same pathPredef.path_string ->
34553455
instance_defPredef.type_string
3456-
|_ ->
3457-
unify env lhs_type (instance_defPredef.type_int);
3458-
instance_defPredef.type_int
3456+
|_ -> (
3457+
try
3458+
unify env lhs_type (instance_defPredef.type_int);
3459+
instance_defPredef.type_int
3460+
withCtype.Unifytrace ->
3461+
raise
3462+
(Error (lhs.exp_loc, env,Expr_type_clash {trace; context=None}))
3463+
)
34593464
in
34603465
let targs= [(lhs_label,Some lhs)]in
34613466
Some (targs, result_type)

‎compiler/syntax/src/res_token.ml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ type t =
7777
|Of
7878
|Land
7979
|Lor
80-
|Bnot(* Bitwiseand: ~~~*)
81-
|Bor(* Bitwiseand: |||*)
82-
|Bxor(* Bitwiseand: ^^^*)
80+
|Bnot(* Bitwisenot: ~~~*)
81+
|Bor(* Bitwiseor: |||*)
82+
|Bxor(* Bitwisexor: ^^^*)
8383
|Band(* Bitwise and: &&&*)
8484
|Caret
8585
|BangEqual
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/bitnot_type_mismatch.res:2:12
4+
5+
1 │ let x = []
6+
2 │ let _ = ~~~x
7+
3 │
8+
9+
This has type: array<'a>
10+
But it's expected to have type: int
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
letx= []
2+
let_= ~~~x

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp