abilities syntax has -> implements

This commit is contained in:
Bryce Miller 2023-05-24 21:29:38 -04:00
parent 55bb8f4b6c
commit 91e37293a2
No known key found for this signature in database
GPG key ID: F1E97BF8DF152350
90 changed files with 438 additions and 437 deletions

View file

@ -106,8 +106,8 @@ fn list() {
derive_test(Decoder, v!(Symbol::LIST_LIST v!(STR)), |golden| {
assert_snapshot!(golden, @r###"
# derived for List Str
# Decoder (List val) fmt | fmt has DecoderFormatting, val has Decoding
# List U8, fmt -[[custom(3)]]-> { rest : List U8, result : [Err [TooShort], Ok (List val)] } | fmt has DecoderFormatting, val has Decoding
# Decoder (List val) fmt | fmt has DecoderFormatting, val implements Decoding
# List U8, fmt -[[custom(3)]]-> { rest : List U8, result : [Err [TooShort], Ok (List val)] } | fmt has DecoderFormatting, val implements Decoding
# Specialization lambda sets:
# @<1>: [[custom(3)]]
#Derived.decoder_list =
@ -124,8 +124,8 @@ fn record_2_fields() {
derive_test(Decoder, v!({first: v!(STR), second: v!(STR),}), |golden| {
assert_snapshot!(golden, @r###"
# derived for { first : Str, second : Str }
# Decoder { first : val, second : val1 } fmt | fmt has DecoderFormatting, val has Decoding, val1 has Decoding
# List U8, fmt -[[custom(22)]]-> { rest : List U8, result : [Err [TooShort], Ok { first : val, second : val1 }] } | fmt has DecoderFormatting, val has Decoding, val1 has Decoding
# Decoder { first : val, second : val1 } fmt | fmt has DecoderFormatting, val has Decoding, val1 implements Decoding
# List U8, fmt -[[custom(22)]]-> { rest : List U8, result : [Err [TooShort], Ok { first : val, second : val1 }] } | fmt has DecoderFormatting, val has Decoding, val1 implements Decoding
# Specialization lambda sets:
# @<1>: [[custom(22)]]
#Derived.decoder_{first,second} =
@ -181,8 +181,8 @@ fn tuple_2_fields() {
derive_test(Decoder, v!((v!(STR), v!(U8),)), |golden| {
assert_snapshot!(golden, @r###"
# derived for ( Str, U8 )*
# Decoder ( val, val1 )* fmt | fmt has DecoderFormatting, val has Decoding, val1 has Decoding
# List U8, fmt -[[custom(22)]]-> { rest : List U8, result : [Err [TooShort], Ok ( val, val1 )a] } | fmt has DecoderFormatting, val has Decoding, val1 has Decoding
# Decoder ( val, val1 )* fmt | fmt has DecoderFormatting, val has Decoding, val1 implements Decoding
# List U8, fmt -[[custom(22)]]-> { rest : List U8, result : [Err [TooShort], Ok ( val, val1 )a] } | fmt has DecoderFormatting, val has Decoding, val1 implements Decoding
# Specialization lambda sets:
# @<1>: [[custom(22)]]
#Derived.decoder_(arity:2) =

View file

@ -188,8 +188,8 @@ fn empty_record() {
derive_test(ToEncoder, v!(EMPTY_RECORD), |golden| {
assert_snapshot!(golden, @r###"
# derived for {}
# {} -[[toEncoder_{}(0)]]-> Encoder fmt | fmt has EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> (List U8, fmt -[[custom(2) {}]]-> List U8) | fmt has EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> Encoder fmt | fmt implements EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> (List U8, fmt -[[custom(2) {}]]-> List U8) | fmt implements EncoderFormatting
# Specialization lambda sets:
# @<1>: [[toEncoder_{}(0)]]
# @<2>: [[custom(2) {}]]
@ -208,8 +208,8 @@ fn zero_field_record() {
derive_test(ToEncoder, v!({}), |golden| {
assert_snapshot!(golden, @r###"
# derived for {}
# {} -[[toEncoder_{}(0)]]-> Encoder fmt | fmt has EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> (List U8, fmt -[[custom(2) {}]]-> List U8) | fmt has EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> Encoder fmt | fmt implements EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> (List U8, fmt -[[custom(2) {}]]-> List U8) | fmt implements EncoderFormatting
# Specialization lambda sets:
# @<1>: [[toEncoder_{}(0)]]
# @<2>: [[custom(2) {}]]
@ -228,11 +228,11 @@ fn one_field_record() {
derive_test(ToEncoder, v!({ a: v!(U8), }), |golden| {
assert_snapshot!(golden, @r###"
# derived for { a : U8 }
# { a : val } -[[toEncoder_{a}(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding
# { a : val } -[[toEncoder_{a}(0)]]-> (List U8, fmt -[[custom(2) { a : val }]]-> List U8) | fmt has EncoderFormatting, val has Encoding
# { a : val } -[[toEncoder_{a}(0)]]-> Encoder fmt | fmt has EncoderFormatting, val implements Encoding
# { a : val } -[[toEncoder_{a}(0)]]-> (List U8, fmt -[[custom(2) { a : val }]]-> List U8) | fmt has EncoderFormatting, val implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_{a}(0)]]
# @<2>: [[custom(2) { a : val }]] | val has Encoding
# @<2>: [[custom(2) { a : val }]] | val implements Encoding
#Derived.toEncoder_{a} =
\#Derived.rcd ->
custom
@ -251,11 +251,11 @@ fn two_field_record() {
derive_test(ToEncoder, v!({ a: v!(U8), b: v!(STR), }), |golden| {
assert_snapshot!(golden, @r###"
# derived for { a : U8, b : Str }
# { a : val, b : val1 } -[[toEncoder_{a,b}(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# { a : val, b : val1 } -[[toEncoder_{a,b}(0)]]-> (List U8, fmt -[[custom(2) { a : val, b : val1 }]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# { a : val, b : val1 } -[[toEncoder_{a,b}(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# { a : val, b : val1 } -[[toEncoder_{a,b}(0)]]-> (List U8, fmt -[[custom(2) { a : val, b : val1 }]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_{a,b}(0)]]
# @<2>: [[custom(2) { a : val, b : val1 }]] | val has Encoding, val1 has Encoding
# @<2>: [[custom(2) { a : val, b : val1 }]] | val has Encoding, val1 implements Encoding
#Derived.toEncoder_{a,b} =
\#Derived.rcd ->
custom
@ -278,11 +278,11 @@ fn two_field_tuple() {
derive_test(ToEncoder, v!((v!(U8), v!(STR),)), |golden| {
assert_snapshot!(golden, @r###"
# derived for ( U8, Str )*
# ( val, val1 )* -[[toEncoder_(arity:2)(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# ( val, val1 )a -[[toEncoder_(arity:2)(0)]]-> (List U8, fmt -[[custom(2) ( val, val1 )a]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# ( val, val1 )* -[[toEncoder_(arity:2)(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# ( val, val1 )a -[[toEncoder_(arity:2)(0)]]-> (List U8, fmt -[[custom(2) ( val, val1 )a]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_(arity:2)(0)]]
# @<2>: [[custom(2) ( val, val1 )*]] | val has Encoding, val1 has Encoding
# @<2>: [[custom(2) ( val, val1 )*]] | val has Encoding, val1 implements Encoding
#Derived.toEncoder_(arity:2) =
\#Derived.tup ->
custom
@ -314,8 +314,8 @@ fn tag_one_label_zero_args() {
derive_test(ToEncoder, v!([A]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A]
# [A] -[[toEncoder_[A 0](0)]]-> Encoder fmt | fmt has EncoderFormatting
# [A] -[[toEncoder_[A 0](0)]]-> (List U8, fmt -[[custom(2) [A]]]-> List U8) | fmt has EncoderFormatting
# [A] -[[toEncoder_[A 0](0)]]-> Encoder fmt | fmt implements EncoderFormatting
# [A] -[[toEncoder_[A 0](0)]]-> (List U8, fmt -[[custom(2) [A]]]-> List U8) | fmt implements EncoderFormatting
# Specialization lambda sets:
# @<1>: [[toEncoder_[A 0](0)]]
# @<2>: [[custom(2) [A]]]
@ -338,11 +338,11 @@ fn tag_one_label_two_args() {
derive_test(ToEncoder, v!([A v!(U8) v!(STR)]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A U8 Str]
# [A val val1] -[[toEncoder_[A 2](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [A val val1] -[[toEncoder_[A 2](0)]]-> (List U8, fmt -[[custom(4) [A val val1]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [A val val1] -[[toEncoder_[A 2](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# [A val val1] -[[toEncoder_[A 2](0)]]-> (List U8, fmt -[[custom(4) [A val val1]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_[A 2](0)]]
# @<2>: [[custom(4) [A val val1]]] | val has Encoding, val1 has Encoding
# @<2>: [[custom(4) [A val val1]]] | val has Encoding, val1 implements Encoding
#Derived.toEncoder_[A 2] =
\#Derived.tag ->
custom
@ -366,11 +366,11 @@ fn tag_two_labels() {
|golden| {
assert_snapshot!(golden, @r###"
# derived for [A U8 Str U16, B Str]
# [A val val1 val1, B val1] -[[toEncoder_[A 3,B 1](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [A val val1 val1, B val1] -[[toEncoder_[A 3,B 1](0)]]-> (List U8, fmt -[[custom(6) [A val val1 val1, B val1]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [A val val1 val1, B val1] -[[toEncoder_[A 3,B 1](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# [A val val1 val1, B val1] -[[toEncoder_[A 3,B 1](0)]]-> (List U8, fmt -[[custom(6) [A val val1 val1, B val1]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_[A 3,B 1](0)]]
# @<2>: [[custom(6) [A val val1 val1, B val1]]] | val has Encoding, val1 has Encoding
# @<2>: [[custom(6) [A val val1 val1, B val1]]] | val has Encoding, val1 implements Encoding
#Derived.toEncoder_[A 3,B 1] =
\#Derived.tag ->
custom
@ -402,11 +402,11 @@ fn recursive_tag_union() {
|golden| {
assert_snapshot!(golden, @r###"
# derived for [Cons U8 $rec, Nil] as $rec
# [Cons val val1, Nil] -[[toEncoder_[Cons 2,Nil 0](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [Cons val val1, Nil] -[[toEncoder_[Cons 2,Nil 0](0)]]-> (List U8, fmt -[[custom(4) [Cons val val1, Nil]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [Cons val val1, Nil] -[[toEncoder_[Cons 2,Nil 0](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# [Cons val val1, Nil] -[[toEncoder_[Cons 2,Nil 0](0)]]-> (List U8, fmt -[[custom(4) [Cons val val1, Nil]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_[Cons 2,Nil 0](0)]]
# @<2>: [[custom(4) [Cons val val1, Nil]]] | val has Encoding, val1 has Encoding
# @<2>: [[custom(4) [Cons val val1, Nil]]] | val has Encoding, val1 implements Encoding
#Derived.toEncoder_[Cons 2,Nil 0] =
\#Derived.tag ->
custom
@ -429,11 +429,11 @@ fn list() {
derive_test(ToEncoder, v!(Symbol::LIST_LIST v!(STR)), |golden| {
assert_snapshot!(golden, @r###"
# derived for List Str
# List val -[[toEncoder_list(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding
# List val -[[toEncoder_list(0)]]-> (List U8, fmt -[[custom(4) (List val)]]-> List U8) | fmt has EncoderFormatting, val has Encoding
# List val -[[toEncoder_list(0)]]-> Encoder fmt | fmt has EncoderFormatting, val implements Encoding
# List val -[[toEncoder_list(0)]]-> (List U8, fmt -[[custom(4) (List val)]]-> List U8) | fmt has EncoderFormatting, val implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_list(0)]]
# @<2>: [[custom(4) (List val)]] | val has Encoding
# @<2>: [[custom(4) (List val)]] | val implements Encoding
#Derived.toEncoder_list =
\#Derived.lst ->
custom

View file

@ -151,8 +151,8 @@ fn empty_record() {
derive_test(Hash, v!(EMPTY_RECORD), |golden| {
assert_snapshot!(golden, @r###"
# derived for {}
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher has Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher has Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher implements Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_{}(0)]]
#Derived.hash_{} = \#Derived.hasher, #Derived.rcd -> #Derived.hasher
@ -166,8 +166,8 @@ fn zero_field_record() {
derive_test(Hash, v!({}), |golden| {
assert_snapshot!(golden, @r###"
# derived for {}
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher has Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher has Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher implements Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_{}(0)]]
#Derived.hash_{} = \#Derived.hasher, #Derived.rcd -> #Derived.hasher
@ -181,8 +181,8 @@ fn one_field_record() {
derive_test(Hash, v!({ a: v!(U8), }), |golden| {
assert_snapshot!(golden, @r###"
# derived for { a : U8 }
# hasher, { a : a } -[[hash_{a}(0)]]-> hasher | a has Hash, hasher has Hasher
# hasher, { a : a } -[[hash_{a}(0)]]-> hasher | a has Hash, hasher has Hasher
# hasher, { a : a } -[[hash_{a}(0)]]-> hasher | a has Hash, hasher implements Hasher
# hasher, { a : a } -[[hash_{a}(0)]]-> hasher | a has Hash, hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_{a}(0)]]
#Derived.hash_{a} =
@ -197,8 +197,8 @@ fn two_field_record() {
derive_test(Hash, v!({ a: v!(U8), b: v!(STR), }), |golden| {
assert_snapshot!(golden, @r###"
# derived for { a : U8, b : Str }
# hasher, { a : a, b : a1 } -[[hash_{a,b}(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, { a : a, b : a1 } -[[hash_{a,b}(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, { a : a, b : a1 } -[[hash_{a,b}(0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# hasher, { a : a, b : a1 } -[[hash_{a,b}(0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_{a,b}(0)]]
#Derived.hash_{a,b} =
@ -214,8 +214,8 @@ fn two_element_tuple() {
derive_test(Hash, v!((v!(U8), v!(STR),)), |golden| {
assert_snapshot!(golden, @r###"
# derived for ( U8, Str )*
# hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_(arity:2)(0)]]
#Derived.hash_(arity:2) =
@ -231,8 +231,8 @@ fn tag_one_label_no_payloads() {
derive_test(Hash, v!([A]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A]
# hasher, [A] -[[hash_[A 0](0)]]-> hasher | hasher has Hasher
# hasher, [A] -[[hash_[A 0](0)]]-> hasher | hasher has Hasher
# hasher, [A] -[[hash_[A 0](0)]]-> hasher | hasher implements Hasher
# hasher, [A] -[[hash_[A 0](0)]]-> hasher | hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_[A 0](0)]]
#Derived.hash_[A 0] = \#Derived.hasher, A -> #Derived.hasher
@ -246,8 +246,8 @@ fn tag_one_label_newtype() {
derive_test(Hash, v!([A v!(U8) v!(STR)]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A U8 Str]
# hasher, [A a a1] -[[hash_[A 2](0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, [A a a1] -[[hash_[A 2](0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, [A a a1] -[[hash_[A 2](0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# hasher, [A a a1] -[[hash_[A 2](0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_[A 2](0)]]
#Derived.hash_[A 2] =
@ -263,8 +263,8 @@ fn tag_two_labels() {
derive_test(Hash, v!([A v!(U8) v!(STR) v!(U16), B v!(STR)]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A U8 Str U16, B Str]
# a, [A a1 a2 a3, B a3] -[[hash_[A 3,B 1](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash, a3 has Hash
# a, [A a1 a2 a3, B a3] -[[hash_[A 3,B 1](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash, a3 has Hash
# a, [A a1 a2 a3, B a3] -[[hash_[A 3,B 1](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash, a3 implements Hash
# a, [A a1 a2 a3, B a3] -[[hash_[A 3,B 1](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash, a3 implements Hash
# Specialization lambda sets:
# @<1>: [[hash_[A 3,B 1](0)]]
#Derived.hash_[A 3,B 1] =
@ -285,8 +285,8 @@ fn tag_two_labels_no_payloads() {
derive_test(Hash, v!([A, B]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A, B]
# a, [A, B] -[[hash_[A 0,B 0](0)]]-> a | a has Hasher
# a, [A, B] -[[hash_[A 0,B 0](0)]]-> a | a has Hasher
# a, [A, B] -[[hash_[A 0,B 0](0)]]-> a | a implements Hasher
# a, [A, B] -[[hash_[A 0,B 0](0)]]-> a | a implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_[A 0,B 0](0)]]
#Derived.hash_[A 0,B 0] =
@ -304,8 +304,8 @@ fn recursive_tag_union() {
derive_test(Hash, v!([Nil, Cons v!(U8) v!(^lst) ] as lst), |golden| {
assert_snapshot!(golden, @r###"
# derived for [Cons U8 $rec, Nil] as $rec
# a, [Cons a1 a2, Nil] -[[hash_[Cons 2,Nil 0](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash
# a, [Cons a1 a2, Nil] -[[hash_[Cons 2,Nil 0](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash
# a, [Cons a1 a2, Nil] -[[hash_[Cons 2,Nil 0](0)]]-> a | a has Hasher, a1 has Hash, a2 implements Hash
# a, [Cons a1 a2, Nil] -[[hash_[Cons 2,Nil 0](0)]]-> a | a has Hasher, a1 has Hash, a2 implements Hash
# Specialization lambda sets:
# @<1>: [[hash_[Cons 2,Nil 0](0)]]
#Derived.hash_[Cons 2,Nil 0] =