fix: private type leaks

This commit is contained in:
rvcas 2024-08-08 18:51:29 -04:00 committed by KtorZ
parent 79840248c0
commit 00b8a39236
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
2 changed files with 25 additions and 25 deletions

View File

@ -415,7 +415,7 @@ mod tests {
assert_validator!( assert_validator!(
r#" r#"
/// On-chain state /// On-chain state
type State { pub type State {
/// The contestation period as a number of seconds /// The contestation period as a number of seconds
contestationPeriod: ContestationPeriod, contestationPeriod: ContestationPeriod,
/// List of public key hashes of all participants /// List of public key hashes of all participants
@ -424,20 +424,20 @@ mod tests {
} }
/// A Hash digest for a given algorithm. /// A Hash digest for a given algorithm.
type Hash<alg> = ByteArray pub type Hash<alg> = ByteArray
type Blake2b_256 { Blake2b_256 } pub type Blake2b_256 { Blake2b_256 }
/// Whatever /// Whatever
type ContestationPeriod { pub type ContestationPeriod {
/// A positive, non-zero number of seconds. /// A positive, non-zero number of seconds.
ContestationPeriod(Int) ContestationPeriod(Int)
} }
type Party = pub type Party =
ByteArray ByteArray
type Input { pub type Input {
CollectCom CollectCom
Close Close
/// Abort a transaction /// Abort a transaction
@ -470,12 +470,12 @@ mod tests {
fn generics() { fn generics() {
assert_validator!( assert_validator!(
r#" r#"
type Either<left, right> { pub type Either<left, right> {
Left(left) Left(left)
Right(right) Right(right)
} }
type Interval<a> { pub type Interval<a> {
Finite(a) Finite(a)
Infinite Infinite
} }
@ -493,8 +493,8 @@ mod tests {
fn free_vars() { fn free_vars() {
assert_validator!( assert_validator!(
r#" r#"
validator { validator generics {
fn generics(redeemer: a, ctx: Void) { spend(redeemer: a, ctx: Void) {
True True
} }
} }
@ -506,11 +506,11 @@ mod tests {
fn list_2_tuples_as_list() { fn list_2_tuples_as_list() {
assert_validator!( assert_validator!(
r#" r#"
type Dict<key, value> { pub type Dict<key, value> {
inner: List<(ByteArray, value)> inner: List<(ByteArray, value)>
} }
type UUID { UUID } pub type UUID { UUID }
validator list_2_tuples_as_list { validator list_2_tuples_as_list {
mint(redeemer: Dict<UUID, Int>, ctx: Void) { mint(redeemer: Dict<UUID, Int>, ctx: Void) {
@ -525,14 +525,14 @@ mod tests {
fn list_pairs_as_map() { fn list_pairs_as_map() {
assert_validator!( assert_validator!(
r#" r#"
type Dict<key, value> { pub type Dict<key, value> {
inner: List<Pair<ByteArray, value>> inner: List<Pair<ByteArray, value>>
} }
type UUID { UUID } pub type UUID { UUID }
validator { validator list_pairs_as_map {
fn list_pairs_as_map(redeemer: Dict<UUID, Int>, ctx: Void) { spend(redeemer: Dict<UUID, Int>, ctx: Void) {
True True
} }
} }
@ -548,7 +548,7 @@ mod tests {
inner: List<(ByteArray, value)> inner: List<(ByteArray, value)>
} }
type UUID { UUID } pub type UUID { UUID }
validator opaque_singleton_variants { validator opaque_singleton_variants {
spend(redeemer: Dict<UUID, Int>, ctx: Void) { spend(redeemer: Dict<UUID, Int>, ctx: Void) {

View File

@ -3673,16 +3673,16 @@ fn when_bool_is_false() {
#[test] #[test]
fn when_tuple_deconstruction() { fn when_tuple_deconstruction() {
let src = r#" let src = r#"
type Thing { pub type Thing {
idx: Int, idx: Int,
} }
type Datum { pub type Datum {
A(Thing) A(Thing)
B B
} }
type RedSpend { pub type RedSpend {
Spend(Int) Spend(Int)
Buy Buy
} }
@ -4037,12 +4037,12 @@ fn when_tuple_empty_lists() {
#[test] #[test]
fn generic_validator_type_test() { fn generic_validator_type_test() {
let src = r#" let src = r#"
type A<x> { pub type A<x> {
NoA NoA
SomeA(Void, x) SomeA(Void, x)
} }
type B { pub type B {
something: Void, something: Void,
} }
@ -5548,15 +5548,15 @@ fn list_clause_with_assign() {
#[test] #[test]
fn opaque_value_in_datum() { fn opaque_value_in_datum() {
let src = r#" let src = r#"
opaque type Value { pub opaque type Value {
inner: Dict<Dict<Int>> inner: Dict<Dict<Int>>
} }
opaque type Dict<v> { pub opaque type Dict<v> {
inner: List<Pair<ByteArray, v>> inner: List<Pair<ByteArray, v>>
} }
type Dat { pub type Dat {
c: Int, c: Int,
a: Value a: Value
} }