Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Commit 07786e9

Browse files
committed
Fix issue where let x:t = ... is treated differently in .res syntax.
1 parent b43ec9b commit 07786e9

File tree

5 files changed

+44
-1
lines changed

5 files changed

+44
-1
lines changed

Changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# master
22
- Add support for different file extensions using the `suffix` configuration from `bsconfig.json`.
3+
- Fix issue where `let x:t = ...` is treated differently in `.res` syntax.
34

45
# 3.45.0
56
- Only support bs-platform `8.2.0` or newer.

examples/flow-react-example/src/LetWithType.bs.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @flow strict
3+
* @generated from LetWithType.res
4+
* @nolint
5+
*/
6+
/* eslint-disable */
7+
8+
// $FlowExpectedError: Reason checked type sufficiently
9+
import * as LetWithTypeBS from './LetWithType.bs';
10+
11+
export opaque type style = mixed;
12+
13+
export const white: style = LetWithTypeBS.white;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
module Style = {
3+
type rec t =
4+
| WHITE
5+
| LIGHT
6+
| GRAY
7+
| CUSTOM(string)
8+
}
9+
10+
include Style
11+
12+
@genType.opaque
13+
type rec style = t
14+
15+
@genType
16+
let white: style = WHITE

src/TranslateStructure.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ let translateValueBinding =
159159
~outputFileRelative,
160160
~resolver,
161161
~typeEnv,
162-
~typeExpr=vb_expr.exp_type,
162+
~typeExpr=vb_pat.pat_type,
163163
~addAnnotationsToFunction=
164164
addAnnotationsToFunctionType(~config, vb_expr),
165165
);

0 commit comments

Comments
 (0)