Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- Fix unpacking first-class module in default argument of react component. https://github.com/rescript-lang/rescript/pull/8296
- Fix exception record field regression. https://github.com/rescript-lang/rescript/pull/8319
- Rewatch: ignore stale lock for unrelated process name. https://github.com/rescript-lang/rescript/pull/8316
- Fix handling of exotic identifiers for let bindings in GenType. https://github.com/rescript-lang/rescript/pull/8315

#### :memo: Documentation

Expand Down
2 changes: 1 addition & 1 deletion compiler/gentype/TranslateSignature.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let translate_signature_value ~config ~output_file_relative ~resolver ~type_env
(val_id, val_attributes |> Annotation.from_attributes ~config ~loc:val_loc)
with
| id, GenType ->
id |> Ident.name
id |> Ident.name |> Ext_ident.unwrap_uppercase_exotic
|> Translation.translate_value ~attributes:val_attributes ~config
~doc_string:(Annotation.doc_string_from_attrs val_attributes)
~output_file_relative ~resolver ~type_env ~type_expr
Expand Down
2 changes: 1 addition & 1 deletion compiler/gentype/TranslateSignatureFromTypes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ and translate_signature_item_from_types ~config ~output_file_relative ~resolver
|> translate_module_declaration_from_types ~config ~output_file_relative
~resolver ~type_env ~id
| Types.Sig_value (id, {val_attributes; val_loc; val_type}) ->
let name = id |> Ident.name in
let name = id |> Ident.name |> Ext_ident.unwrap_uppercase_exotic in
if !Debug.translation then Log_.item "Translate Sig Value %s\n" name;
let module_item = Runtime.new_module_item ~name in
type_env |> TypeEnv.update_module_item ~module_item;
Expand Down
4 changes: 2 additions & 2 deletions compiler/gentype/TranslateStructure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ let translate_value_binding ~config ~output_file_relative ~resolver ~type_env
{Typedtree.vb_attributes; vb_expr; vb_pat} : Translation.t =
match vb_pat.pat_desc with
| Tpat_var (id, _) | Tpat_alias ({pat_desc = Tpat_any}, id, _) ->
let name = id |> Ident.name in
let name = id |> Ident.name |> Ext_ident.unwrap_uppercase_exotic in
if !Debug.translation then Log_.item "Translate Value Binding %s\n" name;
let module_item = Runtime.new_module_item ~name in
type_env |> TypeEnv.update_module_item ~module_item;
Expand All @@ -113,7 +113,7 @@ let translate_value_binding ~config ~output_file_relative ~resolver ~type_env
|> Annotation.from_attributes ~config ~loc:vb_pat.pat_loc
= GenType
then
id |> Ident.name
name
|> Translation.translate_value ~attributes:vb_attributes ~config
~doc_string:(Annotation.doc_string_from_attrs vb_attributes)
~output_file_relative ~resolver ~type_env ~type_expr:vb_pat.pat_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ export type record = {
readonly UPPERCASE: number
};

export type props = {};

export const myRecord: record = EscapedNamesJS.myRecord as any;

export const Icon_Add: React.ComponentType<{}> = EscapedNamesJS.Icon_Add as any;

export const SomeValue: string = EscapedNamesJS.SomeValue as any;
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,12 @@ let myRecord = {
\"Illegal-field name": 7,
\"UPPERCASE": 100,
}

/* https://github.com/rescript-lang/rescript/issues/8312 */
type props = {}
let make = (_: props) => React.null
@genType
let \"Icon_Add": props => React.element = make

@genType
let \"SomeValue" = "hello"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading