Skip to content

Commit

Permalink
Merge pull request #393 from ocsigen/fix-392
Browse files Browse the repository at this point in the history
rescript: prefix invalid ctor names by 'Case'
  • Loading branch information
cannorin authored Mar 4, 2024
2 parents bf70970 + 6acd3a6 commit 1f6d0d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- ReScript: prefix invalid constructor names by `Case` (#392).

## [2.0.0-beta.2]

- Update and fix TypeScript version to `5.3.3`.
Expand Down
2 changes: 1 addition & 1 deletion src/Targets/ReScript/ReScriptHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ module Naming =

let constructorName (name: string list) =
let s = String.concat "_" name |> removeInvalidChars |> upperFirst
if s.StartsWith("_") then "C" + s
if Char.isAlphabet(s[0]) |> not then "Case" + s
else if keywords |> Set.contains s then s + "_"
else s

Expand Down

0 comments on commit 1f6d0d4

Please sign in to comment.