-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support
@mel.as
without @mel.{string,int}
in external polyv…
…ars (#722) * feat: support `@mel.as` without `@mel.{string,int}` in external polyvars * chore: remove now outdated tests * changelog entry * test: add a test case for `@mel.int`
- Loading branch information
1 parent
d6359b4
commit d521e65
Showing
5 changed files
with
116 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
Test `@mel.as` without `@mel.string` / `@mel.int` in external polyvars | ||
|
||
$ . ./setup.sh | ||
$ cat > x.ml <<EOF | ||
> type t = unit | ||
> external transition_timing_function : | ||
> t -> | ||
> [ \`ease | ||
> | \`easeIn [@mel.as "ease-in"] | ||
> ] -> | ||
> unit = "transitionTimingFunction" | ||
> let () = transition_timing_function () \`easeIn | ||
> EOF | ||
$ melc -ppx melppx x.ml | ||
// Generated by Melange | ||
'use strict'; | ||
transitionTimingFunction(undefined, "ease-in"); | ||
/* Not a pure module */ | ||
$ cat > x.ml <<EOF | ||
> type t = unit | ||
> external transition_timing_function : | ||
> t -> | ||
> [ \`ease | ||
> | \`easeIn [@mel.as 1] | ||
> | \`easeOut [@mel.as 2] | ||
> ] -> | ||
> unit = "transitionTimingFunction" | ||
> let () = transition_timing_function () \`easeIn | ||
> EOF | ||
$ melc -ppx melppx x.ml | ||
// Generated by Melange | ||
'use strict'; | ||
transitionTimingFunction(undefined, 1); | ||
/* Not a pure module */ | ||
$ cat > x.ml <<EOF | ||
> type t = unit | ||
> external transition_timing_function : | ||
> t -> | ||
> [ \`ease | ||
> | \`easeIn [@mel.as "ease-in"] | ||
> | \`easeOut [@mel.as 1] | ||
> ] -> | ||
> unit = "transitionTimingFunction" | ||
> let () = transition_timing_function () \`easeIn | ||
> EOF | ||
$ melc -ppx melppx x.ml | ||
File "x.ml", line 6, characters 13-24: | ||
6 | | `easeOut [@mel.as 1] | ||
^^^^^^^^^^^ | ||
Error: expect string literal | ||
[2] | ||
$ cat > x.ml <<EOF | ||
> type t = unit | ||
> external transition_timing_function : | ||
> t -> | ||
> [ \`ease | ||
> | \`easeIn [@mel.as 1] [@mel.as "ease-in"] | ||
> | \`easeOut | ||
> ] -> | ||
> unit = "transitionTimingFunction" | ||
> let () = transition_timing_function () \`easeIn | ||
> EOF | ||
$ melc -ppx melppx x.ml | ||
File "x.ml", line 5, characters 4-43: | ||
5 | | `easeIn [@mel.as 1] [@mel.as "ease-in"] | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error: duplicate @as | ||
[2] | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters