Skip to content

Commit 78011b7

Browse files
committed
Sync latest syntax.
1 parent 67a7b7d commit 78011b7

File tree

6 files changed

+48
-1
lines changed

6 files changed

+48
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
- Deprecate DOM element attributes in `JsxDOM.domProps`: `begin_`, `end_`, `to_`
1818
- Use `begin`, `end`, `to` instead.
19+
- Emit an error when a `@string` or `@int` attribute is used in a V4 component https://github.com/rescript-lang/rescript-compiler/issues/5724
1920

2021
## :rocket: New Feature
2122

jscomp/napkin/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
> - :house: [Internal]
1111
> - :nail_care: [Polish]
1212
13+
#### :boom: Breaking Change
14+
15+
- Emit an error when a `@string` or `@int` attribute is used in a V4 component https://github.com/rescript-lang/rescript-compiler/issues/5724
16+
1317
#### :rocket: New Feature
1418

1519
- Add surface syntax for `async`/`await` https://github.com/rescript-lang/syntax/pull/600

lib/4.06.1/unstable/js_compiler.ml

+14
Original file line numberDiff line numberDiff line change
@@ -273588,6 +273588,16 @@ let argToConcreteType types (name, _loc, type_) =
273588273588
| name when isOptional name -> (true, getLabel name, [], type_) :: types
273589273589
| _ -> types
273590273590

273591+
let check_string_int_attribute_iter =
273592+
let attribute _ ({txt; loc}, _) =
273593+
if txt = "string" || txt = "int" then
273594+
React_jsx_common.raiseError ~loc
273595+
"@string and @int attributes not supported. See \
273596+
https://github.com/rescript-lang/rescript-compiler/issues/5724"
273597+
in
273598+
273599+
{Ast_iterator.default_iterator with attribute}
273600+
273591273601
let transformStructureItem ~config mapper item =
273592273602
match item with
273593273603
(* external *)
@@ -273604,6 +273614,8 @@ let transformStructureItem ~config mapper item =
273604273614
React_jsx_common.raiseErrorMultipleReactComponent ~loc:pstr_loc
273605273615
else (
273606273616
config.hasReactComponent <- true;
273617+
check_string_int_attribute_iter.structure_item
273618+
check_string_int_attribute_iter item;
273607273619
let rec getPropTypes types ({ptyp_loc; ptyp_desc} as fullType) =
273608273620
match ptyp_desc with
273609273621
| Ptyp_arrow (name, type_, ({ptyp_desc = Ptyp_arrow _} as rest))
@@ -274050,6 +274062,8 @@ let transformSignatureItem ~config _mapper item =
274050274062
if config.React_jsx_common.hasReactComponent then
274051274063
React_jsx_common.raiseErrorMultipleReactComponent ~loc:psig_loc
274052274064
else config.hasReactComponent <- true;
274065+
check_string_int_attribute_iter.signature_item
274066+
check_string_int_attribute_iter item;
274053274067
let hasForwardRef = ref false in
274054274068
let rec getPropTypes types ({ptyp_loc; ptyp_desc} as fullType) =
274055274069
match ptyp_desc with

lib/4.06.1/unstable/js_playground_compiler.ml

+14
Original file line numberDiff line numberDiff line change
@@ -275051,6 +275051,16 @@ let argToConcreteType types (name, _loc, type_) =
275051275051
| name when isOptional name -> (true, getLabel name, [], type_) :: types
275052275052
| _ -> types
275053275053

275054+
let check_string_int_attribute_iter =
275055+
let attribute _ ({txt; loc}, _) =
275056+
if txt = "string" || txt = "int" then
275057+
React_jsx_common.raiseError ~loc
275058+
"@string and @int attributes not supported. See \
275059+
https://github.com/rescript-lang/rescript-compiler/issues/5724"
275060+
in
275061+
275062+
{Ast_iterator.default_iterator with attribute}
275063+
275054275064
let transformStructureItem ~config mapper item =
275055275065
match item with
275056275066
(* external *)
@@ -275067,6 +275077,8 @@ let transformStructureItem ~config mapper item =
275067275077
React_jsx_common.raiseErrorMultipleReactComponent ~loc:pstr_loc
275068275078
else (
275069275079
config.hasReactComponent <- true;
275080+
check_string_int_attribute_iter.structure_item
275081+
check_string_int_attribute_iter item;
275070275082
let rec getPropTypes types ({ptyp_loc; ptyp_desc} as fullType) =
275071275083
match ptyp_desc with
275072275084
| Ptyp_arrow (name, type_, ({ptyp_desc = Ptyp_arrow _} as rest))
@@ -275513,6 +275525,8 @@ let transformSignatureItem ~config _mapper item =
275513275525
if config.React_jsx_common.hasReactComponent then
275514275526
React_jsx_common.raiseErrorMultipleReactComponent ~loc:psig_loc
275515275527
else config.hasReactComponent <- true;
275528+
check_string_int_attribute_iter.signature_item
275529+
check_string_int_attribute_iter item;
275516275530
let hasForwardRef = ref false in
275517275531
let rec getPropTypes types ({ptyp_loc; ptyp_desc} as fullType) =
275518275532
match ptyp_desc with

lib/4.06.1/whole_compiler.ml

+14
Original file line numberDiff line numberDiff line change
@@ -285430,6 +285430,16 @@ let argToConcreteType types (name, _loc, type_) =
285430285430
| name when isOptional name -> (true, getLabel name, [], type_) :: types
285431285431
| _ -> types
285432285432

285433+
let check_string_int_attribute_iter =
285434+
let attribute _ ({txt; loc}, _) =
285435+
if txt = "string" || txt = "int" then
285436+
React_jsx_common.raiseError ~loc
285437+
"@string and @int attributes not supported. See \
285438+
https://github.com/rescript-lang/rescript-compiler/issues/5724"
285439+
in
285440+
285441+
{Ast_iterator.default_iterator with attribute}
285442+
285433285443
let transformStructureItem ~config mapper item =
285434285444
match item with
285435285445
(* external *)
@@ -285446,6 +285456,8 @@ let transformStructureItem ~config mapper item =
285446285456
React_jsx_common.raiseErrorMultipleReactComponent ~loc:pstr_loc
285447285457
else (
285448285458
config.hasReactComponent <- true;
285459+
check_string_int_attribute_iter.structure_item
285460+
check_string_int_attribute_iter item;
285449285461
let rec getPropTypes types ({ptyp_loc; ptyp_desc} as fullType) =
285450285462
match ptyp_desc with
285451285463
| Ptyp_arrow (name, type_, ({ptyp_desc = Ptyp_arrow _} as rest))
@@ -285892,6 +285904,8 @@ let transformSignatureItem ~config _mapper item =
285892285904
if config.React_jsx_common.hasReactComponent then
285893285905
React_jsx_common.raiseErrorMultipleReactComponent ~loc:psig_loc
285894285906
else config.hasReactComponent <- true;
285907+
check_string_int_attribute_iter.signature_item
285908+
check_string_int_attribute_iter item;
285895285909
let hasForwardRef = ref false in
285896285910
let rec getPropTypes types ({ptyp_loc; ptyp_desc} as fullType) =
285897285911
match ptyp_desc with

syntax

0 commit comments

Comments
 (0)