-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing serializability checks for interfaces (#12483)
* Add missing serializability checks for interfaces The checks for argument & result type were missing before. I openey #12482 to do the same fix on the Scala side. fixes #12475 changelog_begin changelog_end * . changelog_begin changelog_end
- Loading branch information
1 parent
7c59728
commit 681f8fc
Showing
3 changed files
with
53 additions
and
0 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
21 changes: 21 additions & 0 deletions
21
compiler/damlc/tests/daml-test-files/InterfaceSerializabilityArgument.daml
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,21 @@ | ||
-- @SINCE-LF-FEATURE DAML_INTERFACE | ||
-- @ERROR expected serializable type | ||
module InterfaceSerializabilityArgument where | ||
|
||
data NonSerializable = NonSerializable (() -> ()) | ||
|
||
-- Dummy Eq and Show instances so we blow up in the serializability checker rather than | ||
-- the GHC typechecker. | ||
|
||
instance Eq NonSerializable where | ||
(==) = error "undefined" | ||
instance Show NonSerializable where | ||
show = error "undefined" | ||
|
||
interface I where | ||
p : Party | ||
|
||
choice NonSerializableArgument : () | ||
with f : NonSerializable | ||
controller p this | ||
do pure () |
20 changes: 20 additions & 0 deletions
20
compiler/damlc/tests/daml-test-files/InterfaceSerializabilityResult.daml
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,20 @@ | ||
-- @SINCE-LF-FEATURE DAML_INTERFACE | ||
-- @ERROR expected serializable type | ||
module InterfaceSerializabilityResult where | ||
|
||
data NonSerializable = NonSerializable (() -> ()) | ||
|
||
-- Dummy Eq and Show instances so we blow up in the serializability checker rather than | ||
-- the GHC typechecker. | ||
|
||
instance Eq NonSerializable where | ||
(==) = error "undefined" | ||
instance Show NonSerializable where | ||
show = error "undefined" | ||
|
||
interface I where | ||
p : Party | ||
|
||
choice NonSerializableResult : NonSerializable | ||
controller p this | ||
do pure (NonSerializable identity) |