-
Notifications
You must be signed in to change notification settings - Fork 872
[WIP] Support --typecheck-only for fsi run (just typecheck, no execution) #18687
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4995602
Initial plan for issue
Copilot 89b69aa
Update copilot-setup-steps.yml
T-Gro a8db5c6
Implement --typecheck-only support for FSI scripts
Copilot 7ea403c
Improve TypeCheckOnlyTests with better execution verification
Copilot bd5aa05
Update TypeCheckOnlyTests to use console output instead of file side …
Copilot 9836e52
Merge branch 'main' into copilot/fix-18686
T-Gro e276875
Fix build of test utils
T-Gro d3d4ea0
Merge branch 'main' into copilot/fix-18686
T-Gro 66ba4f3
Make sure success is propagated (as empty fsi value, but no errors)
T-Gro 312cdbd
fantomas
T-Gro 7d5cba7
Merge branch 'main' into copilot/fix-18686
T-Gro 0140ab0
Add release notes for --typecheck-only flag support in F# Interactive
Copilot f43c85a
Update help and ILVerify baselines for --typecheck-only option
Copilot 6daac2e
Merge branch 'main' into copilot/fix-18686
T-Gro c37be65
Merge branch 'main' into copilot/fix-18686
T-Gro bed45ff
Apply patch from /run ilverify
actions-user 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
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
48 changes: 48 additions & 0 deletions
48
tests/FSharp.Compiler.ComponentTests/Scripting/TypeCheckOnlyTests.fs
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,48 @@ | ||
| module FSharp.Compiler.ComponentTests.Scripting.TypeCheckOnlyTests | ||
|
|
||
| open Xunit | ||
| open FSharp.Test | ||
| open FSharp.Test.Compiler | ||
|
|
||
| [<Fact>] | ||
| let ``typecheck-only flag works for valid script``() = | ||
| Fsx """ | ||
| let x = 42 | ||
| printfn "This should not execute" | ||
| """ | ||
| |> withOptions ["--typecheck-only"] | ||
| |> compile | ||
| |> shouldSucceed | ||
|
|
||
| [<Fact>] | ||
| let ``typecheck-only flag catches type errors``() = | ||
| Fsx """ | ||
| let x: int = "string" // Type error | ||
| """ | ||
| |> withOptions ["--typecheck-only"] | ||
| |> compile | ||
| |> shouldFail | ||
| |> withDiagnostics [ | ||
| (Error 1, Line 2, Col 14, Line 2, Col 22, "This expression was expected to have type\n 'int' \nbut here has type\n 'string'") | ||
| ] | ||
|
|
||
| [<Fact>] | ||
| let ``typecheck-only flag prevents execution side effects``() = | ||
| Fsx """ | ||
| printfn "MyCrazyString" | ||
| let x = 42 | ||
| """ | ||
| |> withOptions ["--typecheck-only"] | ||
| |> runFsi | ||
| |> shouldSucceed | ||
| |> VerifyNotInOutput "MyCrazyString" | ||
|
|
||
| [<Fact>] | ||
| let ``script executes without typecheck-only flag``() = | ||
| Fsx """ | ||
| printfn "MyCrazyString" | ||
| let x = 42 | ||
| """ | ||
| |> runFsi | ||
| |> shouldSucceed | ||
| |> verifyOutput "MyCrazyString" |
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
Oops, something went wrong.
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.