-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test that generated $$imports value has the right contents
- Loading branch information
Showing
5 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
compiler/damlc/tests/daml-test-files/ModuleImports_Datatype.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,6 @@ | ||
-- Copyright (c) 2021, Digital Asset (Switzerland) GmbH and/or its affiliates. | ||
-- All rights reserved. | ||
|
||
module ModuleImports_Datatype (T (..)) where | ||
|
||
data T = T |
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,9 @@ | ||
-- Copyright (c) 2021, Digital Asset (Switzerland) GmbH and/or its affiliates. | ||
-- All rights reserved. | ||
|
||
-- This test checks that we produce an $$imports value including all modules from which this one imports orphan instances, even transitively. | ||
-- @QUERY-LF .modules[] | select(lf::get_dotted_name($pkg) == ["ModuleImports_Main"]) | .values[].name_with_type | select(lf::get_value_name($pkg) == ["$$$$imports"]) | lf::norm_imports($pkg) | any(. == {package: null, module: ["ModuleImports_OrphanInstance"]}) | ||
|
||
module ModuleImports_Main () where | ||
|
||
import ModuleImports_Middleman () |
9 changes: 9 additions & 0 deletions
9
compiler/damlc/tests/daml-test-files/ModuleImports_Middleman.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,9 @@ | ||
-- Copyright (c) 2021, Digital Asset (Switzerland) GmbH and/or its affiliates. | ||
-- All rights reserved. | ||
|
||
-- This test checks that we produce an $$imports value including all modules from which this one imports orphan instances. | ||
-- @QUERY-LF .modules[] | select(lf::get_dotted_name($pkg) == ["ModuleImports_Middleman"]) | .values[].name_with_type | select(lf::get_value_name($pkg) == ["$$$$imports"]) | lf::norm_imports($pkg) | any(. == {package: null, module: ["ModuleImports_OrphanInstance"]}) | ||
|
||
module ModuleImports_Middleman () where | ||
|
||
import ModuleImports_OrphanInstance () |
11 changes: 11 additions & 0 deletions
11
compiler/damlc/tests/daml-test-files/ModuleImports_OrphanInstance.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,11 @@ | ||
-- Copyright (c) 2021, Digital Asset (Switzerland) GmbH and/or its affiliates. | ||
-- All rights reserved. | ||
|
||
{-# OPTIONS_GHC -Wno-orphans #-} | ||
|
||
module ModuleImports_OrphanInstance (T (..)) where | ||
|
||
import ModuleImports_Datatype (T (..)) | ||
|
||
instance Show T where | ||
show T = "T" |
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