-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
typechecker: add workaround for fallout from #2162.
Statements of the forms x <- e; x <- s; s; where e is a non-monadic term and s is a monadic term in the wrong monad are now accepted with a warning instead of causing a fatal type error. Note that statements of the form e; which also used to be accepted will now fail. The chance of this appearing in the wild is low. While I've fixed all the fallout in the saw tree, the amount (and nature) suggests that downstream users will also have cases to fix and we should allow time for this before making it a hard fail. Add tests for all these forms.
- Loading branch information
1 parent
0dcb4e9
commit 2be7724
Showing
10 changed files
with
194 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Loading file "err006.saw" | ||
err006.saw:3:1-3:20: Warning: Monadic bind of non-monadic value; rewrite as let-binding or use return | ||
err006.saw:3:1-3:20: Warning: This will become an error in a future release of SAW |
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,3 @@ | ||
// This was allowed prior to Dec 2024 and is currently a warning; | ||
// should eventually become an error. | ||
x <- concat [0] [1]; |
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,12 @@ | ||
Loading file "err007.saw" | ||
err007.saw:2:1-2:4: Type mismatch. | ||
Mismatch of type constructors. Expected: <Block> but got ([]) | ||
err007.saw:2:1-2:4: The type TopLevel t.0 arises from this type annotation | ||
err007.saw:2:1-2:4: The type [Int] arises from the type of this term | ||
|
||
Expected: TopLevel t.0 | ||
Found: [Int] | ||
|
||
within "<toplevel>" (err007.saw:2:1-2:4) | ||
|
||
FAILED |
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,2 @@ | ||
// This was allowed prior to Dec 2024 and now fails. | ||
[0]; |
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,4 @@ | ||
Loading file "err008.saw" | ||
err008.saw:3:1-3:19: Warning: Monadic bind with the wrong monad; found LLVMSetup but expected TopLevel | ||
err008.saw:3:1-3:19: Warning: This was historically ignored and will have no effect; if you really want to do this, prefix the expression with return | ||
err008.saw:3:1-3:19: Warning: This will become an error in a future release of SAW |
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,3 @@ | ||
// This was allowed prior to Dec 2024 and is currently a warning; | ||
// should eventually become an error. | ||
llvm_assert {{ True }}; |
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,4 @@ | ||
Loading file "err009.saw" | ||
err009.saw:4:1-4:40: Warning: Monadic bind with the wrong monad; found LLVMSetup but expected TopLevel | ||
err009.saw:4:1-4:40: Warning: This was historically ignored and will have no effect; if you really want to do this, prefix the expression with return | ||
err009.saw:4:1-4:40: Warning: This will become an error in a future release of SAW |
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,4 @@ | ||
// This was allowed prior to Dec 2024 and is currently a warning; | ||
// should eventually become an error. | ||
enable_experimental; | ||
x <- llvm_fresh_cryptol_var "foo" {| [8] |}; |
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