-
Notifications
You must be signed in to change notification settings - Fork 471
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cristianoc
wants to merge
8
commits into
master
Choose a base branch
from
codex-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.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
992088e
compiler: update typecore; tests: add VariantCoercionConstructUsed; d…
cristianoc 7f1f3c4
next iter
cristianoc 1844a6c
typecore: mark constructors used on variant coercion; add super-error…
cristianoc 6012c86
changelog: link variant coercion unused-constructor fix to #7839
cristianoc 5d5e111
typecore: avoid option tuple match; wrap both extractions in single t…
cristianoc bfcef55
typecore: speed up constructor membership with StringSet
cristianoc 2c6a0e9
chore: remove example.res and issue.txt
cristianoc 7da7c05
typecore: avoid false 'constructor … is never used' after variant coe…
cristianoc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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 deletions
13
tests/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 deletions
16
tests/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) |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 */ |
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.
Uh oh!
There was an error while loading. Please reload this page.