- Notifications
You must be signed in to change notification settings - Fork471
compiler: update typecore; tests: add VariantCoercionConstructUsed; d…#7839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
cristianoc wants to merge8 commits intomasterChoose a base branch fromcodex-on-issue-7838
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Open
Changes fromall commits
Commits
Show all changes
8 commits Select commitHold shift + click to select a range
992088e compiler: update typecore; tests: add VariantCoercionConstructUsed; d…
cristianoc7f1f3c4 next iter
cristianoc1844a6c typecore: mark constructors used on variant coercion; add super-error…
cristianoc6012c86 changelog: link variant coercion unused-constructor fix to #7839
cristianoc5d5e111 typecore: avoid option tuple match; wrap both extractions in single t…
cristianocbfcef55 typecore: speed up constructor membership with StringSet
cristianoc2c6a0e9 chore: remove example.res and issue.txt
cristianoc7da7c05 typecore: avoid false 'constructor … is never used' after variant coe…
cristianocFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
26 changes: 23 additions & 3 deletionsAGENTS.md
This file contains hidden or 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
1 change: 1 addition & 0 deletionsCHANGELOG.md
This file contains hidden or 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
30 changes: 30 additions & 0 deletionscompiler/ml/typecore.ml
This file contains hidden or 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
13 changes: 13 additions & 0 deletionstests/build_tests/super_errors/expected/VariantCoercionWarnOnC.res.expected
This file contains hidden or 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,13 @@ | ||
| [1;33mWarning number 37[0m | ||
| [36m/.../fixtures/VariantCoercionWarnOnC.res[0m:[2m9:3-11:7[0m | ||
| 7 [2m│[0m let log: a => unit | ||
| 8 [2m│[0m } = { | ||
| [1;33m9[0m [2m│[0m [1;33mtype b =[0m | ||
| [1;33m10[0m [2m│[0m [1;33m | ...a[0m | ||
| [1;33m11[0m [2m│[0m [1;33m | C[0m | ||
| 12 [2m│[0m | ||
| 13 [2m│[0m let log = (x: a) => Js.log((x :> b)) | ||
| unused constructor C. |
16 changes: 16 additions & 0 deletionstests/build_tests/super_errors/fixtures/VariantCoercionWarnOnC.res
This file contains hidden or 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,16 @@ | ||
| // Ensure unused-constructor warning still fires for new members introduced | ||
| // only on the target side of a coercion. | ||
| type a = A | B | ||
| module M: { | ||
| let log: a => unit | ||
| } = { | ||
| type b = | ||
| | ...a | ||
| | C | ||
| let log = (x: a) => Js.log((x :> b)) | ||
| } | ||
| let _ = M.log(A) |
6 changes: 5 additions & 1 deletiontests/docstring_tests/DocTest.res
This file contains hidden or 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 |
|---|---|---|
| @@ -62,7 +62,11 @@ let extractDocFromFile = async file => { | ||
| } | ||
| } | ||
| // Some environments may report 0 CPUs; clamp to at least 1 to avoid zero-sized batches | ||
| let batchSize = switch OS.cpus()->Array.length { | ||
| | n if n > 0 => n | ||
| | _ => 1 | ||
| } | ||
cristianoc marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| let runtimePath = Path.join(["packages", "@rescript", "runtime"]) | ||
4 changes: 3 additions & 1 deletiontests/docstring_tests/DocTest.res.js
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
17 changes: 17 additions & 0 deletionstests/tests/src/VariantCoercionConstructUsed.mjs
This file contains hidden or 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,17 @@ | ||
| // Generated by ReScript, PLEASE EDIT WITH CARE | ||
| function log(x) { | ||
| console.log(x); | ||
| } | ||
| let DoNotWarn = { | ||
| log: log | ||
| }; | ||
| console.log("A"); | ||
| export { | ||
| DoNotWarn, | ||
| } | ||
| /* Not a pure module */ |
15 changes: 15 additions & 0 deletionstests/tests/src/VariantCoercionConstructUsed.res
This file contains hidden or 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,15 @@ | ||
| // Repro for incorrect "constructor ... is never used" warning with coercions | ||
| // This should compile cleanly without warnings when coercing from a -> b. | ||
| type a = A | B | ||
| module DoNotWarn: { | ||
| let log: a => unit | ||
| } = { | ||
| type b = | ||
| | ...a | ||
| | C | ||
| let log = (x: a) => Js.log((x :> b)) | ||
| } | ||
| let _ = DoNotWarn.log(A) |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.