mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 09:17:43 +03:00
ifaces: tests: check for interface collisions in ast (#13196)
* ifaces: tests: check for interface collisions in ast We add a test to check for interface name collisions in the daml-lf AST. CHANGELOG_BEGIN CHANGELOG_END * Update daml-lf/language/src/test/scala/com/digitalasset/daml/lf/language/AstSpec.scala Co-authored-by: Remy <remy.haemmerle@daml.com> Co-authored-by: Remy <remy.haemmerle@daml.com>
This commit is contained in:
parent
1c4b767295
commit
be6bbc82b9
@ -60,6 +60,14 @@ class AstSpec extends AnyWordSpec with TableDrivenPropertyChecks with Matchers {
|
||||
key = None,
|
||||
implements = VectorMap.empty,
|
||||
)
|
||||
def interface = DefInterface(
|
||||
param = Name.assertFromString("x"),
|
||||
precond = ETrue,
|
||||
fixedChoices = Map.empty,
|
||||
methods = Map.empty,
|
||||
requires = Set.empty,
|
||||
)
|
||||
|
||||
def exception = DefException(
|
||||
message = eText
|
||||
)
|
||||
@ -137,6 +145,40 @@ class AstSpec extends AnyWordSpec with TableDrivenPropertyChecks with Matchers {
|
||||
)
|
||||
}
|
||||
|
||||
"catch interface collisions" in {
|
||||
|
||||
Module.build(
|
||||
name = modName1,
|
||||
definitions = List(
|
||||
defName("defName1") -> recordDef,
|
||||
defName("defName2") -> recordDef,
|
||||
),
|
||||
interfaces = List(
|
||||
defName("defName1") -> interface
|
||||
),
|
||||
exceptions = List.empty,
|
||||
templates = List.empty,
|
||||
featureFlags = FeatureFlags.default,
|
||||
)
|
||||
|
||||
a[PackageError] shouldBe thrownBy(
|
||||
Module.build(
|
||||
name = modName1,
|
||||
definitions = List(
|
||||
defName("defName1") -> recordDef,
|
||||
defName("defName2") -> recordDef,
|
||||
),
|
||||
interfaces = List(
|
||||
defName("defName1") -> interface,
|
||||
defName("defName1") -> interface,
|
||||
),
|
||||
templates = List.empty,
|
||||
exceptions = List.empty,
|
||||
featureFlags = FeatureFlags.default,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
"catch exception collisions" in {
|
||||
Module.build(
|
||||
name = modName1,
|
||||
|
Loading…
Reference in New Issue
Block a user