diff options
Diffstat (limited to 'dhall/src')
-rw-r--r-- | dhall/src/lib.rs | 8 | ||||
-rw-r--r-- | dhall/src/normalize.rs | 340 | ||||
-rw-r--r-- | dhall/src/parser.rs | 6 | ||||
-rw-r--r-- | dhall/src/tests.rs | 176 | ||||
-rw-r--r-- | dhall/src/typecheck.rs | 303 |
5 files changed, 833 insertions, 0 deletions
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs index f00e5b6..c9a8f7c 100644 --- a/dhall/src/lib.rs +++ b/dhall/src/lib.rs @@ -1,12 +1,20 @@ #![feature(trace_macros)] #![feature(proc_macro_hygiene)] #![feature(slice_patterns)] +#![cfg_attr(test, feature(custom_inner_attributes))] #![allow( clippy::type_complexity, clippy::infallible_destructuring_match, clippy::many_single_char_names )] +#[cfg(test)] +#[macro_use] +mod tests; + +#[cfg(test)] +mod parser; + mod binary; mod imports; mod normalize; diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs index ac730a9..7cd74e7 100644 --- a/dhall/src/normalize.rs +++ b/dhall/src/normalize.rs @@ -321,3 +321,343 @@ where { normalize_ref(e.as_ref()).roll() } + +#[cfg(test)] +mod tests { + #![rustfmt::skip] + + macro_rules! norm { + ($name:ident, $path:expr) => { + make_spec_test!(Normalization, $name, $path); + }; + } + + norm!(spec_success_haskell_tutorial_access_0, "haskell-tutorial/access/0"); + // norm!(spec_success_haskell_tutorial_access_1, "haskell-tutorial/access/1"); + // norm!(spec_success_haskell_tutorial_combineTypes_0, "haskell-tutorial/combineTypes/0"); + // norm!(spec_success_haskell_tutorial_combineTypes_1, "haskell-tutorial/combineTypes/1"); + // norm!(spec_success_haskell_tutorial_prefer_0, "haskell-tutorial/prefer/0"); + norm!(spec_success_haskell_tutorial_projection_0, "haskell-tutorial/projection/0"); + + + norm!(spec_success_prelude_Bool_and_0, "prelude/Bool/and/0"); + norm!(spec_success_prelude_Bool_and_1, "prelude/Bool/and/1"); + norm!(spec_success_prelude_Bool_build_0, "prelude/Bool/build/0"); + norm!(spec_success_prelude_Bool_build_1, "prelude/Bool/build/1"); + norm!(spec_success_prelude_Bool_even_0, "prelude/Bool/even/0"); + norm!(spec_success_prelude_Bool_even_1, "prelude/Bool/even/1"); + norm!(spec_success_prelude_Bool_even_2, "prelude/Bool/even/2"); + norm!(spec_success_prelude_Bool_even_3, "prelude/Bool/even/3"); + norm!(spec_success_prelude_Bool_fold_0, "prelude/Bool/fold/0"); + norm!(spec_success_prelude_Bool_fold_1, "prelude/Bool/fold/1"); + norm!(spec_success_prelude_Bool_not_0, "prelude/Bool/not/0"); + norm!(spec_success_prelude_Bool_not_1, "prelude/Bool/not/1"); + norm!(spec_success_prelude_Bool_odd_0, "prelude/Bool/odd/0"); + norm!(spec_success_prelude_Bool_odd_1, "prelude/Bool/odd/1"); + norm!(spec_success_prelude_Bool_odd_2, "prelude/Bool/odd/2"); + norm!(spec_success_prelude_Bool_odd_3, "prelude/Bool/odd/3"); + norm!(spec_success_prelude_Bool_or_0, "prelude/Bool/or/0"); + norm!(spec_success_prelude_Bool_or_1, "prelude/Bool/or/1"); + norm!(spec_success_prelude_Bool_show_0, "prelude/Bool/show/0"); + norm!(spec_success_prelude_Bool_show_1, "prelude/Bool/show/1"); + // norm!(spec_success_prelude_Double_show_0, "prelude/Double/show/0"); + // norm!(spec_success_prelude_Double_show_1, "prelude/Double/show/1"); + // norm!(spec_success_prelude_Integer_show_0, "prelude/Integer/show/0"); + // norm!(spec_success_prelude_Integer_show_1, "prelude/Integer/show/1"); + // norm!(spec_success_prelude_Integer_toDouble_0, "prelude/Integer/toDouble/0"); + // norm!(spec_success_prelude_Integer_toDouble_1, "prelude/Integer/toDouble/1"); + norm!(spec_success_prelude_List_all_0, "prelude/List/all/0"); + norm!(spec_success_prelude_List_all_1, "prelude/List/all/1"); + norm!(spec_success_prelude_List_any_0, "prelude/List/any/0"); + norm!(spec_success_prelude_List_any_1, "prelude/List/any/1"); + norm!(spec_success_prelude_List_build_0, "prelude/List/build/0"); + norm!(spec_success_prelude_List_build_1, "prelude/List/build/1"); + norm!(spec_success_prelude_List_concat_0, "prelude/List/concat/0"); + norm!(spec_success_prelude_List_concat_1, "prelude/List/concat/1"); + norm!(spec_success_prelude_List_concatMap_0, "prelude/List/concatMap/0"); + norm!(spec_success_prelude_List_concatMap_1, "prelude/List/concatMap/1"); + norm!(spec_success_prelude_List_filter_0, "prelude/List/filter/0"); + norm!(spec_success_prelude_List_filter_1, "prelude/List/filter/1"); + norm!(spec_success_prelude_List_fold_0, "prelude/List/fold/0"); + norm!(spec_success_prelude_List_fold_1, "prelude/List/fold/1"); + norm!(spec_success_prelude_List_fold_2, "prelude/List/fold/2"); + norm!(spec_success_prelude_List_generate_0, "prelude/List/generate/0"); + norm!(spec_success_prelude_List_generate_1, "prelude/List/generate/1"); + norm!(spec_success_prelude_List_head_0, "prelude/List/head/0"); + norm!(spec_success_prelude_List_head_1, "prelude/List/head/1"); + norm!(spec_success_prelude_List_indexed_0, "prelude/List/indexed/0"); + norm!(spec_success_prelude_List_indexed_1, "prelude/List/indexed/1"); + norm!(spec_success_prelude_List_iterate_0, "prelude/List/iterate/0"); + norm!(spec_success_prelude_List_iterate_1, "prelude/List/iterate/1"); + norm!(spec_success_prelude_List_last_0, "prelude/List/last/0"); + norm!(spec_success_prelude_List_last_1, "prelude/List/last/1"); + norm!(spec_success_prelude_List_length_0, "prelude/List/length/0"); + norm!(spec_success_prelude_List_length_1, "prelude/List/length/1"); + norm!(spec_success_prelude_List_map_0, "prelude/List/map/0"); + norm!(spec_success_prelude_List_map_1, "prelude/List/map/1"); + norm!(spec_success_prelude_List_null_0, "prelude/List/null/0"); + norm!(spec_success_prelude_List_null_1, "prelude/List/null/1"); + norm!(spec_success_prelude_List_replicate_0, "prelude/List/replicate/0"); + norm!(spec_success_prelude_List_replicate_1, "prelude/List/replicate/1"); + norm!(spec_success_prelude_List_reverse_0, "prelude/List/reverse/0"); + norm!(spec_success_prelude_List_reverse_1, "prelude/List/reverse/1"); + norm!(spec_success_prelude_List_shifted_0, "prelude/List/shifted/0"); + norm!(spec_success_prelude_List_shifted_1, "prelude/List/shifted/1"); + norm!(spec_success_prelude_List_unzip_0, "prelude/List/unzip/0"); + norm!(spec_success_prelude_List_unzip_1, "prelude/List/unzip/1"); + norm!(spec_success_prelude_Natural_build_0, "prelude/Natural/build/0"); + norm!(spec_success_prelude_Natural_build_1, "prelude/Natural/build/1"); + norm!(spec_success_prelude_Natural_enumerate_0, "prelude/Natural/enumerate/0"); + norm!(spec_success_prelude_Natural_enumerate_1, "prelude/Natural/enumerate/1"); + norm!(spec_success_prelude_Natural_even_0, "prelude/Natural/even/0"); + norm!(spec_success_prelude_Natural_even_1, "prelude/Natural/even/1"); + norm!(spec_success_prelude_Natural_fold_0, "prelude/Natural/fold/0"); + norm!(spec_success_prelude_Natural_fold_1, "prelude/Natural/fold/1"); + norm!(spec_success_prelude_Natural_fold_2, "prelude/Natural/fold/2"); + norm!(spec_success_prelude_Natural_isZero_0, "prelude/Natural/isZero/0"); + norm!(spec_success_prelude_Natural_isZero_1, "prelude/Natural/isZero/1"); + norm!(spec_success_prelude_Natural_odd_0, "prelude/Natural/odd/0"); + norm!(spec_success_prelude_Natural_odd_1, "prelude/Natural/odd/1"); + norm!(spec_success_prelude_Natural_product_0, "prelude/Natural/product/0"); + norm!(spec_success_prelude_Natural_product_1, "prelude/Natural/product/1"); + norm!(spec_success_prelude_Natural_show_0, "prelude/Natural/show/0"); + norm!(spec_success_prelude_Natural_show_1, "prelude/Natural/show/1"); + norm!(spec_success_prelude_Natural_sum_0, "prelude/Natural/sum/0"); + norm!(spec_success_prelude_Natural_sum_1, "prelude/Natural/sum/1"); + // norm!(spec_success_prelude_Natural_toDouble_0, "prelude/Natural/toDouble/0"); + // norm!(spec_success_prelude_Natural_toDouble_1, "prelude/Natural/toDouble/1"); + norm!(spec_success_prelude_Natural_toInteger_0, "prelude/Natural/toInteger/0"); + norm!(spec_success_prelude_Natural_toInteger_1, "prelude/Natural/toInteger/1"); + norm!(spec_success_prelude_Optional_all_0, "prelude/Optional/all/0"); + norm!(spec_success_prelude_Optional_all_1, "prelude/Optional/all/1"); + norm!(spec_success_prelude_Optional_any_0, "prelude/Optional/any/0"); + norm!(spec_success_prelude_Optional_any_1, "prelude/Optional/any/1"); + norm!(spec_success_prelude_Optional_build_0, "prelude/Optional/build/0"); + norm!(spec_success_prelude_Optional_build_1, "prelude/Optional/build/1"); + norm!(spec_success_prelude_Optional_concat_0, "prelude/Optional/concat/0"); + norm!(spec_success_prelude_Optional_concat_1, "prelude/Optional/concat/1"); + norm!(spec_success_prelude_Optional_concat_2, "prelude/Optional/concat/2"); + norm!(spec_success_prelude_Optional_filter_0, "prelude/Optional/filter/0"); + norm!(spec_success_prelude_Optional_filter_1, "prelude/Optional/filter/1"); + norm!(spec_success_prelude_Optional_fold_0, "prelude/Optional/fold/0"); + norm!(spec_success_prelude_Optional_fold_1, "prelude/Optional/fold/1"); + norm!(spec_success_prelude_Optional_head_0, "prelude/Optional/head/0"); + norm!(spec_success_prelude_Optional_head_1, "prelude/Optional/head/1"); + norm!(spec_success_prelude_Optional_head_2, "prelude/Optional/head/2"); + norm!(spec_success_prelude_Optional_last_0, "prelude/Optional/last/0"); + norm!(spec_success_prelude_Optional_last_1, "prelude/Optional/last/1"); + norm!(spec_success_prelude_Optional_last_2, "prelude/Optional/last/2"); + norm!(spec_success_prelude_Optional_length_0, "prelude/Optional/length/0"); + norm!(spec_success_prelude_Optional_length_1, "prelude/Optional/length/1"); + norm!(spec_success_prelude_Optional_map_0, "prelude/Optional/map/0"); + norm!(spec_success_prelude_Optional_map_1, "prelude/Optional/map/1"); + norm!(spec_success_prelude_Optional_null_0, "prelude/Optional/null/0"); + norm!(spec_success_prelude_Optional_null_1, "prelude/Optional/null/1"); + norm!(spec_success_prelude_Optional_toList_0, "prelude/Optional/toList/0"); + norm!(spec_success_prelude_Optional_toList_1, "prelude/Optional/toList/1"); + norm!(spec_success_prelude_Optional_unzip_0, "prelude/Optional/unzip/0"); + norm!(spec_success_prelude_Optional_unzip_1, "prelude/Optional/unzip/1"); + norm!(spec_success_prelude_Text_concat_0, "prelude/Text/concat/0"); + norm!(spec_success_prelude_Text_concat_1, "prelude/Text/concat/1"); + // norm!(spec_success_prelude_Text_concatMap_0, "prelude/Text/concatMap/0"); + norm!(spec_success_prelude_Text_concatMap_1, "prelude/Text/concatMap/1"); + // norm!(spec_success_prelude_Text_concatMapSep_0, "prelude/Text/concatMapSep/0"); + // norm!(spec_success_prelude_Text_concatMapSep_1, "prelude/Text/concatMapSep/1"); + // norm!(spec_success_prelude_Text_concatSep_0, "prelude/Text/concatSep/0"); + // norm!(spec_success_prelude_Text_concatSep_1, "prelude/Text/concatSep/1"); + // norm!(spec_success_prelude_Text_show_0, "prelude/Text/show/0"); + // norm!(spec_success_prelude_Text_show_1, "prelude/Text/show/1"); + + + + // norm!(spec_success_remoteSystems, "remoteSystems"); + // norm!(spec_success_simple_doubleShow, "simple/doubleShow"); + // norm!(spec_success_simple_integerShow, "simple/integerShow"); + // norm!(spec_success_simple_integerToDouble, "simple/integerToDouble"); + // norm!(spec_success_simple_letlet, "simple/letlet"); + norm!(spec_success_simple_listBuild, "simple/listBuild"); + norm!(spec_success_simple_multiLine, "simple/multiLine"); + norm!(spec_success_simple_naturalBuild, "simple/naturalBuild"); + norm!(spec_success_simple_naturalPlus, "simple/naturalPlus"); + norm!(spec_success_simple_naturalShow, "simple/naturalShow"); + norm!(spec_success_simple_naturalToInteger, "simple/naturalToInteger"); + norm!(spec_success_simple_optionalBuild, "simple/optionalBuild"); + norm!(spec_success_simple_optionalBuildFold, "simple/optionalBuildFold"); + norm!(spec_success_simple_optionalFold, "simple/optionalFold"); + // norm!(spec_success_simple_sortOperator, "simple/sortOperator"); + // norm!(spec_success_simplifications_and, "simplifications/and"); + // norm!(spec_success_simplifications_eq, "simplifications/eq"); + // norm!(spec_success_simplifications_ifThenElse, "simplifications/ifThenElse"); + // norm!(spec_success_simplifications_ne, "simplifications/ne"); + // norm!(spec_success_simplifications_or, "simplifications/or"); + + + norm!(spec_success_unit_Bool, "unit/Bool"); + norm!(spec_success_unit_Double, "unit/Double"); + norm!(spec_success_unit_DoubleLiteral, "unit/DoubleLiteral"); + norm!(spec_success_unit_DoubleShow, "unit/DoubleShow"); + // norm!(spec_success_unit_DoubleShowValue, "unit/DoubleShowValue"); + norm!(spec_success_unit_FunctionApplicationCapture, "unit/FunctionApplicationCapture"); + norm!(spec_success_unit_FunctionApplicationNoSubstitute, "unit/FunctionApplicationNoSubstitute"); + norm!(spec_success_unit_FunctionApplicationNormalizeArguments, "unit/FunctionApplicationNormalizeArguments"); + norm!(spec_success_unit_FunctionApplicationSubstitute, "unit/FunctionApplicationSubstitute"); + norm!(spec_success_unit_FunctionNormalizeArguments, "unit/FunctionNormalizeArguments"); + norm!(spec_success_unit_FunctionTypeNormalizeArguments, "unit/FunctionTypeNormalizeArguments"); + // norm!(spec_success_unit_IfAlternativesIdentical, "unit/IfAlternativesIdentical"); + norm!(spec_success_unit_IfFalse, "unit/IfFalse"); + norm!(spec_success_unit_IfNormalizePredicateAndBranches, "unit/IfNormalizePredicateAndBranches"); + // norm!(spec_success_unit_IfTrivial, "unit/IfTrivial"); + norm!(spec_success_unit_IfTrue, "unit/IfTrue"); + norm!(spec_success_unit_Integer, "unit/Integer"); + norm!(spec_success_unit_IntegerNegative, "unit/IntegerNegative"); + norm!(spec_success_unit_IntegerPositive, "unit/IntegerPositive"); + // norm!(spec_success_unit_IntegerShow_12, "unit/IntegerShow-12"); + // norm!(spec_success_unit_IntegerShow12, "unit/IntegerShow12"); + norm!(spec_success_unit_IntegerShow, "unit/IntegerShow"); + // norm!(spec_success_unit_IntegerToDouble_12, "unit/IntegerToDouble-12"); + // norm!(spec_success_unit_IntegerToDouble12, "unit/IntegerToDouble12"); + norm!(spec_success_unit_IntegerToDouble, "unit/IntegerToDouble"); + norm!(spec_success_unit_Kind, "unit/Kind"); + norm!(spec_success_unit_Let, "unit/Let"); + norm!(spec_success_unit_LetWithType, "unit/LetWithType"); + norm!(spec_success_unit_List, "unit/List"); + norm!(spec_success_unit_ListBuild, "unit/ListBuild"); + norm!(spec_success_unit_ListBuildFoldFusion, "unit/ListBuildFoldFusion"); + norm!(spec_success_unit_ListBuildImplementation, "unit/ListBuildImplementation"); + norm!(spec_success_unit_ListFold, "unit/ListFold"); + norm!(spec_success_unit_ListFoldEmpty, "unit/ListFoldEmpty"); + norm!(spec_success_unit_ListFoldOne, "unit/ListFoldOne"); + norm!(spec_success_unit_ListHead, "unit/ListHead"); + norm!(spec_success_unit_ListHeadEmpty, "unit/ListHeadEmpty"); + norm!(spec_success_unit_ListHeadOne, "unit/ListHeadOne"); + norm!(spec_success_unit_ListIndexed, "unit/ListIndexed"); + norm!(spec_success_unit_ListIndexedEmpty, "unit/ListIndexedEmpty"); + norm!(spec_success_unit_ListIndexedOne, "unit/ListIndexedOne"); + norm!(spec_success_unit_ListLast, "unit/ListLast"); + norm!(spec_success_unit_ListLastEmpty, "unit/ListLastEmpty"); + norm!(spec_success_unit_ListLastOne, "unit/ListLastOne"); + norm!(spec_success_unit_ListLength, "unit/ListLength"); + norm!(spec_success_unit_ListLengthEmpty, "unit/ListLengthEmpty"); + norm!(spec_success_unit_ListLengthOne, "unit/ListLengthOne"); + norm!(spec_success_unit_ListNormalizeElements, "unit/ListNormalizeElements"); + norm!(spec_success_unit_ListNormalizeTypeAnnotation, "unit/ListNormalizeTypeAnnotation"); + norm!(spec_success_unit_ListReverse, "unit/ListReverse"); + norm!(spec_success_unit_ListReverseEmpty, "unit/ListReverseEmpty"); + norm!(spec_success_unit_ListReverseTwo, "unit/ListReverseTwo"); + // norm!(spec_success_unit_Merge, "unit/Merge"); + norm!(spec_success_unit_MergeNormalizeArguments, "unit/MergeNormalizeArguments"); + norm!(spec_success_unit_MergeWithType, "unit/MergeWithType"); + norm!(spec_success_unit_MergeWithTypeNormalizeArguments, "unit/MergeWithTypeNormalizeArguments"); + norm!(spec_success_unit_Natural, "unit/Natural"); + norm!(spec_success_unit_NaturalBuild, "unit/NaturalBuild"); + norm!(spec_success_unit_NaturalBuildFoldFusion, "unit/NaturalBuildFoldFusion"); + norm!(spec_success_unit_NaturalBuildImplementation, "unit/NaturalBuildImplementation"); + norm!(spec_success_unit_NaturalEven, "unit/NaturalEven"); + norm!(spec_success_unit_NaturalEvenOne, "unit/NaturalEvenOne"); + norm!(spec_success_unit_NaturalEvenZero, "unit/NaturalEvenZero"); + norm!(spec_success_unit_NaturalFold, "unit/NaturalFold"); + norm!(spec_success_unit_NaturalFoldOne, "unit/NaturalFoldOne"); + norm!(spec_success_unit_NaturalFoldZero, "unit/NaturalFoldZero"); + norm!(spec_success_unit_NaturalIsZero, "unit/NaturalIsZero"); + norm!(spec_success_unit_NaturalIsZeroOne, "unit/NaturalIsZeroOne"); + norm!(spec_success_unit_NaturalIsZeroZero, "unit/NaturalIsZeroZero"); + norm!(spec_success_unit_NaturalLiteral, "unit/NaturalLiteral"); + norm!(spec_success_unit_NaturalOdd, "unit/NaturalOdd"); + norm!(spec_success_unit_NaturalOddOne, "unit/NaturalOddOne"); + norm!(spec_success_unit_NaturalOddZero, "unit/NaturalOddZero"); + norm!(spec_success_unit_NaturalShow, "unit/NaturalShow"); + norm!(spec_success_unit_NaturalShowOne, "unit/NaturalShowOne"); + norm!(spec_success_unit_NaturalToInteger, "unit/NaturalToInteger"); + norm!(spec_success_unit_NaturalToIntegerOne, "unit/NaturalToIntegerOne"); + norm!(spec_success_unit_None, "unit/None"); + norm!(spec_success_unit_NoneNatural, "unit/NoneNatural"); + // norm!(spec_success_unit_OperatorAndEquivalentArguments, "unit/OperatorAndEquivalentArguments"); + // norm!(spec_success_unit_OperatorAndLhsFalse, "unit/OperatorAndLhsFalse"); + // norm!(spec_success_unit_OperatorAndLhsTrue, "unit/OperatorAndLhsTrue"); + // norm!(spec_success_unit_OperatorAndNormalizeArguments, "unit/OperatorAndNormalizeArguments"); + // norm!(spec_success_unit_OperatorAndRhsFalse, "unit/OperatorAndRhsFalse"); + // norm!(spec_success_unit_OperatorAndRhsTrue, "unit/OperatorAndRhsTrue"); + // norm!(spec_success_unit_OperatorEqualEquivalentArguments, "unit/OperatorEqualEquivalentArguments"); + // norm!(spec_success_unit_OperatorEqualLhsTrue, "unit/OperatorEqualLhsTrue"); + // norm!(spec_success_unit_OperatorEqualNormalizeArguments, "unit/OperatorEqualNormalizeArguments"); + // norm!(spec_success_unit_OperatorEqualRhsTrue, "unit/OperatorEqualRhsTrue"); + norm!(spec_success_unit_OperatorListConcatenateLhsEmpty, "unit/OperatorListConcatenateLhsEmpty"); + norm!(spec_success_unit_OperatorListConcatenateListList, "unit/OperatorListConcatenateListList"); + norm!(spec_success_unit_OperatorListConcatenateNormalizeArguments, "unit/OperatorListConcatenateNormalizeArguments"); + norm!(spec_success_unit_OperatorListConcatenateRhsEmpty, "unit/OperatorListConcatenateRhsEmpty"); + // norm!(spec_success_unit_OperatorNotEqualEquivalentArguments, "unit/OperatorNotEqualEquivalentArguments"); + // norm!(spec_success_unit_OperatorNotEqualLhsFalse, "unit/OperatorNotEqualLhsFalse"); + // norm!(spec_success_unit_OperatorNotEqualNormalizeArguments, "unit/OperatorNotEqualNormalizeArguments"); + // norm!(spec_success_unit_OperatorNotEqualRhsFalse, "unit/OperatorNotEqualRhsFalse"); + // norm!(spec_success_unit_OperatorOrEquivalentArguments, "unit/OperatorOrEquivalentArguments"); + // norm!(spec_success_unit_OperatorOrLhsFalse, "unit/OperatorOrLhsFalse"); + // norm!(spec_success_unit_OperatorOrLhsTrue, "unit/OperatorOrLhsTrue"); + // norm!(spec_success_unit_OperatorOrNormalizeArguments, "unit/OperatorOrNormalizeArguments"); + // norm!(spec_success_unit_OperatorOrRhsFalse, "unit/OperatorOrRhsFalse"); + // norm!(spec_success_unit_OperatorOrRhsTrue, "unit/OperatorOrRhsTrue"); + // norm!(spec_success_unit_OperatorPlusLhsZero, "unit/OperatorPlusLhsZero"); + // norm!(spec_success_unit_OperatorPlusNormalizeArguments, "unit/OperatorPlusNormalizeArguments"); + norm!(spec_success_unit_OperatorPlusOneAndOne, "unit/OperatorPlusOneAndOne"); + // norm!(spec_success_unit_OperatorPlusRhsZero, "unit/OperatorPlusRhsZero"); + // norm!(spec_success_unit_OperatorTextConcatenateLhsEmpty, "unit/OperatorTextConcatenateLhsEmpty"); + // norm!(spec_success_unit_OperatorTextConcatenateNormalizeArguments, "unit/OperatorTextConcatenateNormalizeArguments"); + // norm!(spec_success_unit_OperatorTextConcatenateRhsEmpty, "unit/OperatorTextConcatenateRhsEmpty"); + norm!(spec_success_unit_OperatorTextConcatenateTextText, "unit/OperatorTextConcatenateTextText"); + // norm!(spec_success_unit_OperatorTimesLhsOne, "unit/OperatorTimesLhsOne"); + // norm!(spec_success_unit_OperatorTimesLhsZero, "unit/OperatorTimesLhsZero"); + // norm!(spec_success_unit_OperatorTimesNormalizeArguments, "unit/OperatorTimesNormalizeArguments"); + // norm!(spec_success_unit_OperatorTimesRhsOne, "unit/OperatorTimesRhsOne"); + // norm!(spec_success_unit_OperatorTimesRhsZero, "unit/OperatorTimesRhsZero"); + norm!(spec_success_unit_OperatorTimesTwoAndTwo, "unit/OperatorTimesTwoAndTwo"); + norm!(spec_success_unit_Optional, "unit/Optional"); + norm!(spec_success_unit_OptionalBuild, "unit/OptionalBuild"); + norm!(spec_success_unit_OptionalBuildFoldFusion, "unit/OptionalBuildFoldFusion"); + norm!(spec_success_unit_OptionalBuildImplementation, "unit/OptionalBuildImplementation"); + norm!(spec_success_unit_OptionalFold, "unit/OptionalFold"); + norm!(spec_success_unit_OptionalFoldNone, "unit/OptionalFoldNone"); + norm!(spec_success_unit_OptionalFoldSome, "unit/OptionalFoldSome"); + norm!(spec_success_unit_Record, "unit/Record"); + norm!(spec_success_unit_RecordEmpty, "unit/RecordEmpty"); + norm!(spec_success_unit_RecordProjection, "unit/RecordProjection"); + norm!(spec_success_unit_RecordProjectionEmpty, "unit/RecordProjectionEmpty"); + norm!(spec_success_unit_RecordProjectionNormalizeArguments, "unit/RecordProjectionNormalizeArguments"); + norm!(spec_success_unit_RecordSelection, "unit/RecordSelection"); + norm!(spec_success_unit_RecordSelectionNormalizeArguments, "unit/RecordSelectionNormalizeArguments"); + norm!(spec_success_unit_RecordType, "unit/RecordType"); + norm!(spec_success_unit_RecordTypeEmpty, "unit/RecordTypeEmpty"); + // norm!(spec_success_unit_RecursiveRecordMergeCollision, "unit/RecursiveRecordMergeCollision"); + // norm!(spec_success_unit_RecursiveRecordMergeLhsEmpty, "unit/RecursiveRecordMergeLhsEmpty"); + // norm!(spec_success_unit_RecursiveRecordMergeNoCollision, "unit/RecursiveRecordMergeNoCollision"); + // norm!(spec_success_unit_RecursiveRecordMergeNormalizeArguments, "unit/RecursiveRecordMergeNormalizeArguments"); + // norm!(spec_success_unit_RecursiveRecordMergeRhsEmpty, "unit/RecursiveRecordMergeRhsEmpty"); + // norm!(spec_success_unit_RecursiveRecordTypeMergeCollision, "unit/RecursiveRecordTypeMergeCollision"); + // norm!(spec_success_unit_RecursiveRecordTypeMergeLhsEmpty, "unit/RecursiveRecordTypeMergeLhsEmpty"); + // norm!(spec_success_unit_RecursiveRecordTypeMergeNoCollision, "unit/RecursiveRecordTypeMergeNoCollision"); + // norm!(spec_success_unit_RecursiveRecordTypeMergeNormalizeArguments, "unit/RecursiveRecordTypeMergeNormalizeArguments"); + // norm!(spec_success_unit_RecursiveRecordTypeMergeRhsEmpty, "unit/RecursiveRecordTypeMergeRhsEmpty"); + // norm!(spec_success_unit_RightBiasedRecordMergeCollision, "unit/RightBiasedRecordMergeCollision"); + // norm!(spec_success_unit_RightBiasedRecordMergeLhsEmpty, "unit/RightBiasedRecordMergeLhsEmpty"); + // norm!(spec_success_unit_RightBiasedRecordMergeNoCollision, "unit/RightBiasedRecordMergeNoCollision"); + // norm!(spec_success_unit_RightBiasedRecordMergeNormalizeArguments, "unit/RightBiasedRecordMergeNormalizeArguments"); + // norm!(spec_success_unit_RightBiasedRecordMergeRhsEmpty, "unit/RightBiasedRecordMergeRhsEmpty"); + norm!(spec_success_unit_SomeNormalizeArguments, "unit/SomeNormalizeArguments"); + norm!(spec_success_unit_Sort, "unit/Sort"); + norm!(spec_success_unit_Text, "unit/Text"); + // norm!(spec_success_unit_TextInterpolate, "unit/TextInterpolate"); + norm!(spec_success_unit_TextLiteral, "unit/TextLiteral"); + norm!(spec_success_unit_TextNormalizeInterpolations, "unit/TextNormalizeInterpolations"); + norm!(spec_success_unit_TextShow, "unit/TextShow"); + // norm!(spec_success_unit_TextShowAllEscapes, "unit/TextShowAllEscapes"); + norm!(spec_success_unit_True, "unit/True"); + norm!(spec_success_unit_Type, "unit/Type"); + norm!(spec_success_unit_TypeAnnotation, "unit/TypeAnnotation"); + // norm!(spec_success_unit_UnionNormalizeAlternatives, "unit/UnionNormalizeAlternatives"); + norm!(spec_success_unit_UnionNormalizeArguments, "unit/UnionNormalizeArguments"); + // norm!(spec_success_unit_UnionProjectConstructor, "unit/UnionProjectConstructor"); + norm!(spec_success_unit_UnionProjectConstructorNormalizeArguments, "unit/UnionProjectConstructorNormalizeArguments"); + // norm!(spec_success_unit_UnionSortAlternatives, "unit/UnionSortAlternatives"); + // norm!(spec_success_unit_UnionType, "unit/UnionType"); + norm!(spec_success_unit_UnionTypeEmpty, "unit/UnionTypeEmpty"); + // norm!(spec_success_unit_UnionTypeNormalizeArguments, "unit/UnionTypeNormalizeArguments"); + norm!(spec_success_unit_Variable, "unit/Variable"); +} diff --git a/dhall/src/parser.rs b/dhall/src/parser.rs new file mode 100644 index 0000000..59683b6 --- /dev/null +++ b/dhall/src/parser.rs @@ -0,0 +1,6 @@ +#[cfg(test)] +mod tests { + #![rustfmt::skip] + // See ../build.rs + include!(concat!(env!("OUT_DIR"), "/parser_tests.rs")); +} diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs new file mode 100644 index 0000000..ae6fd12 --- /dev/null +++ b/dhall/src/tests.rs @@ -0,0 +1,176 @@ +use pretty_assertions::assert_eq as assert_eq_pretty; + +macro_rules! assert_eq_display { + ($left:expr, $right:expr) => {{ + match (&$left, &$right) { + (left_val, right_val) => { + if !(*left_val == *right_val) { + panic!( + r#"assertion failed: `(left == right)` + left: `{}`, +right: `{}`"#, + left_val, right_val + ) + } + } + } + }}; +} + +#[macro_export] +macro_rules! make_spec_test { + ($type:ident, $name:ident, $path:expr) => { + #[test] + #[allow(non_snake_case)] + fn $name() { + use crate::tests::*; + run_test($path, Feature::$type); + } + }; +} + +use crate::*; +use dhall_core::*; +use std::path::PathBuf; + +#[allow(dead_code)] +pub enum Feature { + ParserSuccess, + ParserFailure, + Normalization, + TypecheckSuccess, + TypecheckFailure, + TypeInferenceSuccess, + TypeInferenceFailure, +} + +// Deprecated +fn read_dhall_file<'i>(file_path: &str) -> Result<Expr<X, X>, ImportError> { + crate::load_dhall_file(&PathBuf::from(file_path), true) +} + +fn load_from_file_str<'i>( + file_path: &str, +) -> Result<crate::expr::Parsed, ImportError> { + crate::expr::Parsed::load_from_file(&PathBuf::from(file_path)) +} + +fn load_from_binary_file_str<'i>( + file_path: &str, +) -> Result<crate::expr::Parsed, ImportError> { + crate::expr::Parsed::load_from_binary_file(&PathBuf::from(file_path)) +} + +pub fn run_test(base_path: &str, feature: Feature) { + use self::Feature::*; + let base_path_prefix = match feature { + ParserSuccess => "parser/success/", + ParserFailure => "parser/failure/", + Normalization => "normalization/success/", + TypecheckSuccess => "typecheck/success/", + TypecheckFailure => "typecheck/failure/", + TypeInferenceSuccess => "type-inference/success/", + TypeInferenceFailure => "type-inference/failure/", + }; + let base_path = + "../dhall-lang/tests/".to_owned() + base_path_prefix + base_path; + match feature { + ParserSuccess => { + let expr_file_path = base_path.clone() + "A.dhall"; + let expected_file_path = base_path + "B.dhallb"; + let expr = load_from_file_str(&expr_file_path) + .map_err(|e| println!("{}", e)) + .unwrap(); + + let expected = load_from_binary_file_str(&expected_file_path) + .map_err(|e| println!("{}", e)) + .unwrap(); + + assert_eq_pretty!(expr, expected); + + // Round-trip pretty-printer + let expr = + crate::expr::Parsed::load_from_str(&expr.to_string()).unwrap(); + assert_eq!(expr, expected); + } + ParserFailure => { + let file_path = base_path + ".dhall"; + let err = load_from_file_str(&file_path).unwrap_err(); + match err { + ImportError::ParseError(_) => {} + e => panic!("Expected parse error, got: {:?}", e), + } + } + Normalization => { + let expr_file_path = base_path.clone() + "A.dhall"; + let expected_file_path = base_path + "B.dhall"; + let expr = load_from_file_str(&expr_file_path) + .unwrap() + .resolve() + .unwrap() + .skip_typecheck() + .normalize(); + let expected = load_from_file_str(&expected_file_path) + .unwrap() + .resolve() + .unwrap() + .skip_typecheck() + .normalize(); + + assert_eq_display!(expr, expected); + } + TypecheckFailure => { + let file_path = base_path + ".dhall"; + load_from_file_str(&file_path) + .unwrap() + .skip_resolve() + .unwrap() + .typecheck() + .unwrap_err(); + } + TypecheckSuccess => { + // Many tests stack overflow in debug mode + std::thread::Builder::new() + .stack_size(4 * 1024 * 1024) + .spawn(|| { + let expr_file_path = base_path.clone() + "A.dhall"; + let expected_file_path = base_path + "B.dhall"; + let expr = rc(read_dhall_file(&expr_file_path).unwrap()); + let expected = + rc(read_dhall_file(&expected_file_path).unwrap()); + typecheck::type_of(crate::subexpr!(expr: expected)) + .unwrap(); + }) + .unwrap() + .join() + .unwrap(); + } + TypeInferenceFailure => { + let file_path = base_path + ".dhall"; + load_from_file_str(&file_path) + .unwrap() + .skip_resolve() + .unwrap() + .typecheck() + .unwrap_err(); + } + TypeInferenceSuccess => { + let expr_file_path = base_path.clone() + "A.dhall"; + let expected_file_path = base_path + "B.dhall"; + let expr = load_from_file_str(&expr_file_path) + .unwrap() + .skip_resolve() + .unwrap() + .typecheck() + .unwrap(); + let ty = expr.get_type().as_normalized().unwrap(); + let expected = load_from_file_str(&expected_file_path) + .unwrap() + .skip_resolve() + .unwrap() + .skip_typecheck() + .skip_normalize(); + assert_eq_display!(ty, &expected); + } + } +} diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs index 04c042b..cf45d2a 100644 --- a/dhall/src/typecheck.rs +++ b/dhall/src/typecheck.rs @@ -705,3 +705,306 @@ impl<S> fmt::Display for TypeMessage<S> { } } } + +#[cfg(test)] +mod tests { + #![rustfmt::skip] + + macro_rules! tc_success { + ($name:ident, $path:expr) => { + make_spec_test!(TypecheckSuccess, $name, $path); + }; + } + // macro_rules! tc_failure { + // ($name:ident, $path:expr) => { + // make_spec_test!(TypecheckFailure, $name, $path); + // }; + // } + + macro_rules! ti_success { + ($name:ident, $path:expr) => { + make_spec_test!(TypeInferenceSuccess, $name, $path); + }; + } + // macro_rules! ti_failure { + // ($name:ident, $path:expr) => { + // make_spec_test!(TypeInferenceFailure, $name, $path); + // }; + // } + + // tc_success!(spec_tc_success_accessEncodedType, "accessEncodedType"); + // tc_success!(spec_tc_success_accessType, "accessType"); + tc_success!(spec_tc_success_prelude_Bool_and_0, "prelude/Bool/and/0"); + tc_success!(spec_tc_success_prelude_Bool_and_1, "prelude/Bool/and/1"); + tc_success!(spec_tc_success_prelude_Bool_build_0, "prelude/Bool/build/0"); + tc_success!(spec_tc_success_prelude_Bool_build_1, "prelude/Bool/build/1"); + tc_success!(spec_tc_success_prelude_Bool_even_0, "prelude/Bool/even/0"); + tc_success!(spec_tc_success_prelude_Bool_even_1, "prelude/Bool/even/1"); + tc_success!(spec_tc_success_prelude_Bool_even_2, "prelude/Bool/even/2"); + tc_success!(spec_tc_success_prelude_Bool_even_3, "prelude/Bool/even/3"); + tc_success!(spec_tc_success_prelude_Bool_fold_0, "prelude/Bool/fold/0"); + tc_success!(spec_tc_success_prelude_Bool_fold_1, "prelude/Bool/fold/1"); + tc_success!(spec_tc_success_prelude_Bool_not_0, "prelude/Bool/not/0"); + tc_success!(spec_tc_success_prelude_Bool_not_1, "prelude/Bool/not/1"); + tc_success!(spec_tc_success_prelude_Bool_odd_0, "prelude/Bool/odd/0"); + tc_success!(spec_tc_success_prelude_Bool_odd_1, "prelude/Bool/odd/1"); + tc_success!(spec_tc_success_prelude_Bool_odd_2, "prelude/Bool/odd/2"); + tc_success!(spec_tc_success_prelude_Bool_odd_3, "prelude/Bool/odd/3"); + tc_success!(spec_tc_success_prelude_Bool_or_0, "prelude/Bool/or/0"); + tc_success!(spec_tc_success_prelude_Bool_or_1, "prelude/Bool/or/1"); + tc_success!(spec_tc_success_prelude_Bool_show_0, "prelude/Bool/show/0"); + tc_success!(spec_tc_success_prelude_Bool_show_1, "prelude/Bool/show/1"); + // tc_success!(spec_tc_success_prelude_Double_show_0, "prelude/Double/show/0"); + // tc_success!(spec_tc_success_prelude_Double_show_1, "prelude/Double/show/1"); + // tc_success!(spec_tc_success_prelude_Integer_show_0, "prelude/Integer/show/0"); + // tc_success!(spec_tc_success_prelude_Integer_show_1, "prelude/Integer/show/1"); + // tc_success!(spec_tc_success_prelude_Integer_toDouble_0, "prelude/Integer/toDouble/0"); + // tc_success!(spec_tc_success_prelude_Integer_toDouble_1, "prelude/Integer/toDouble/1"); + tc_success!(spec_tc_success_prelude_List_all_0, "prelude/List/all/0"); + tc_success!(spec_tc_success_prelude_List_all_1, "prelude/List/all/1"); + tc_success!(spec_tc_success_prelude_List_any_0, "prelude/List/any/0"); + tc_success!(spec_tc_success_prelude_List_any_1, "prelude/List/any/1"); + tc_success!(spec_tc_success_prelude_List_build_0, "prelude/List/build/0"); + tc_success!(spec_tc_success_prelude_List_build_1, "prelude/List/build/1"); + tc_success!(spec_tc_success_prelude_List_concat_0, "prelude/List/concat/0"); + tc_success!(spec_tc_success_prelude_List_concat_1, "prelude/List/concat/1"); + tc_success!(spec_tc_success_prelude_List_concatMap_0, "prelude/List/concatMap/0"); + tc_success!(spec_tc_success_prelude_List_concatMap_1, "prelude/List/concatMap/1"); + tc_success!(spec_tc_success_prelude_List_filter_0, "prelude/List/filter/0"); + tc_success!(spec_tc_success_prelude_List_filter_1, "prelude/List/filter/1"); + tc_success!(spec_tc_success_prelude_List_fold_0, "prelude/List/fold/0"); + tc_success!(spec_tc_success_prelude_List_fold_1, "prelude/List/fold/1"); + tc_success!(spec_tc_success_prelude_List_fold_2, "prelude/List/fold/2"); + tc_success!(spec_tc_success_prelude_List_generate_0, "prelude/List/generate/0"); + tc_success!(spec_tc_success_prelude_List_generate_1, "prelude/List/generate/1"); + tc_success!(spec_tc_success_prelude_List_head_0, "prelude/List/head/0"); + tc_success!(spec_tc_success_prelude_List_head_1, "prelude/List/head/1"); + tc_success!(spec_tc_success_prelude_List_indexed_0, "prelude/List/indexed/0"); + tc_success!(spec_tc_success_prelude_List_indexed_1, "prelude/List/indexed/1"); + tc_success!(spec_tc_success_prelude_List_iterate_0, "prelude/List/iterate/0"); + tc_success!(spec_tc_success_prelude_List_iterate_1, "prelude/List/iterate/1"); + tc_success!(spec_tc_success_prelude_List_last_0, "prelude/List/last/0"); + tc_success!(spec_tc_success_prelude_List_last_1, "prelude/List/last/1"); + tc_success!(spec_tc_success_prelude_List_length_0, "prelude/List/length/0"); + tc_success!(spec_tc_success_prelude_List_length_1, "prelude/List/length/1"); + tc_success!(spec_tc_success_prelude_List_map_0, "prelude/List/map/0"); + tc_success!(spec_tc_success_prelude_List_map_1, "prelude/List/map/1"); + tc_success!(spec_tc_success_prelude_List_null_0, "prelude/List/null/0"); + tc_success!(spec_tc_success_prelude_List_null_1, "prelude/List/null/1"); + tc_success!(spec_tc_success_prelude_List_replicate_0, "prelude/List/replicate/0"); + tc_success!(spec_tc_success_prelude_List_replicate_1, "prelude/List/replicate/1"); + tc_success!(spec_tc_success_prelude_List_reverse_0, "prelude/List/reverse/0"); + tc_success!(spec_tc_success_prelude_List_reverse_1, "prelude/List/reverse/1"); + tc_success!(spec_tc_success_prelude_List_shifted_0, "prelude/List/shifted/0"); + tc_success!(spec_tc_success_prelude_List_shifted_1, "prelude/List/shifted/1"); + tc_success!(spec_tc_success_prelude_List_unzip_0, "prelude/List/unzip/0"); + tc_success!(spec_tc_success_prelude_List_unzip_1, "prelude/List/unzip/1"); + tc_success!(spec_tc_success_prelude_Monoid_00, "prelude/Monoid/00"); + tc_success!(spec_tc_success_prelude_Monoid_01, "prelude/Monoid/01"); + tc_success!(spec_tc_success_prelude_Monoid_02, "prelude/Monoid/02"); + tc_success!(spec_tc_success_prelude_Monoid_03, "prelude/Monoid/03"); + tc_success!(spec_tc_success_prelude_Monoid_04, "prelude/Monoid/04"); + tc_success!(spec_tc_success_prelude_Monoid_05, "prelude/Monoid/05"); + tc_success!(spec_tc_success_prelude_Monoid_06, "prelude/Monoid/06"); + tc_success!(spec_tc_success_prelude_Monoid_07, "prelude/Monoid/07"); + tc_success!(spec_tc_success_prelude_Monoid_08, "prelude/Monoid/08"); + tc_success!(spec_tc_success_prelude_Monoid_09, "prelude/Monoid/09"); + tc_success!(spec_tc_success_prelude_Monoid_10, "prelude/Monoid/10"); + tc_success!(spec_tc_success_prelude_Natural_build_0, "prelude/Natural/build/0"); + tc_success!(spec_tc_success_prelude_Natural_build_1, "prelude/Natural/build/1"); + tc_success!(spec_tc_success_prelude_Natural_enumerate_0, "prelude/Natural/enumerate/0"); + tc_success!(spec_tc_success_prelude_Natural_enumerate_1, "prelude/Natural/enumerate/1"); + tc_success!(spec_tc_success_prelude_Natural_even_0, "prelude/Natural/even/0"); + tc_success!(spec_tc_success_prelude_Natural_even_1, "prelude/Natural/even/1"); + tc_success!(spec_tc_success_prelude_Natural_fold_0, "prelude/Natural/fold/0"); + tc_success!(spec_tc_success_prelude_Natural_fold_1, "prelude/Natural/fold/1"); + tc_success!(spec_tc_success_prelude_Natural_fold_2, "prelude/Natural/fold/2"); + tc_success!(spec_tc_success_prelude_Natural_isZero_0, "prelude/Natural/isZero/0"); + tc_success!(spec_tc_success_prelude_Natural_isZero_1, "prelude/Natural/isZero/1"); + tc_success!(spec_tc_success_prelude_Natural_odd_0, "prelude/Natural/odd/0"); + tc_success!(spec_tc_success_prelude_Natural_odd_1, "prelude/Natural/odd/1"); + tc_success!(spec_tc_success_prelude_Natural_product_0, "prelude/Natural/product/0"); + tc_success!(spec_tc_success_prelude_Natural_product_1, "prelude/Natural/product/1"); + // tc_success!(spec_tc_success_prelude_Natural_show_0, "prelude/Natural/show/0"); + // tc_success!(spec_tc_success_prelude_Natural_show_1, "prelude/Natural/show/1"); + tc_success!(spec_tc_success_prelude_Natural_sum_0, "prelude/Natural/sum/0"); + tc_success!(spec_tc_success_prelude_Natural_sum_1, "prelude/Natural/sum/1"); + // tc_success!(spec_tc_success_prelude_Natural_toDouble_0, "prelude/Natural/toDouble/0"); + // tc_success!(spec_tc_success_prelude_Natural_toDouble_1, "prelude/Natural/toDouble/1"); + // tc_success!(spec_tc_success_prelude_Natural_toInteger_0, "prelude/Natural/toInteger/0"); + // tc_success!(spec_tc_success_prelude_Natural_toInteger_1, "prelude/Natural/toInteger/1"); + tc_success!(spec_tc_success_prelude_Optional_all_0, "prelude/Optional/all/0"); + tc_success!(spec_tc_success_prelude_Optional_all_1, "prelude/Optional/all/1"); + tc_success!(spec_tc_success_prelude_Optional_any_0, "prelude/Optional/any/0"); + tc_success!(spec_tc_success_prelude_Optional_any_1, "prelude/Optional/any/1"); + // tc_success!(spec_tc_success_prelude_Optional_build_0, "prelude/Optional/build/0"); + // tc_success!(spec_tc_success_prelude_Optional_build_1, "prelude/Optional/build/1"); + tc_success!(spec_tc_success_prelude_Optional_concat_0, "prelude/Optional/concat/0"); + tc_success!(spec_tc_success_prelude_Optional_concat_1, "prelude/Optional/concat/1"); + tc_success!(spec_tc_success_prelude_Optional_concat_2, "prelude/Optional/concat/2"); + // tc_success!(spec_tc_success_prelude_Optional_filter_0, "prelude/Optional/filter/0"); + // tc_success!(spec_tc_success_prelude_Optional_filter_1, "prelude/Optional/filter/1"); + tc_success!(spec_tc_success_prelude_Optional_fold_0, "prelude/Optional/fold/0"); + tc_success!(spec_tc_success_prelude_Optional_fold_1, "prelude/Optional/fold/1"); + tc_success!(spec_tc_success_prelude_Optional_head_0, "prelude/Optional/head/0"); + tc_success!(spec_tc_success_prelude_Optional_head_1, "prelude/Optional/head/1"); + tc_success!(spec_tc_success_prelude_Optional_head_2, "prelude/Optional/head/2"); + tc_success!(spec_tc_success_prelude_Optional_last_0, "prelude/Optional/last/0"); + tc_success!(spec_tc_success_prelude_Optional_last_1, "prelude/Optional/last/1"); + tc_success!(spec_tc_success_prelude_Optional_last_2, "prelude/Optional/last/2"); + tc_success!(spec_tc_success_prelude_Optional_length_0, "prelude/Optional/length/0"); + tc_success!(spec_tc_success_prelude_Optional_length_1, "prelude/Optional/length/1"); + tc_success!(spec_tc_success_prelude_Optional_map_0, "prelude/Optional/map/0"); + tc_success!(spec_tc_success_prelude_Optional_map_1, "prelude/Optional/map/1"); + tc_success!(spec_tc_success_prelude_Optional_null_0, "prelude/Optional/null/0"); + tc_success!(spec_tc_success_prelude_Optional_null_1, "prelude/Optional/null/1"); + tc_success!(spec_tc_success_prelude_Optional_toList_0, "prelude/Optional/toList/0"); + tc_success!(spec_tc_success_prelude_Optional_toList_1, "prelude/Optional/toList/1"); + tc_success!(spec_tc_success_prelude_Optional_unzip_0, "prelude/Optional/unzip/0"); + tc_success!(spec_tc_success_prelude_Optional_unzip_1, "prelude/Optional/unzip/1"); + tc_success!(spec_tc_success_prelude_Text_concat_0, "prelude/Text/concat/0"); + tc_success!(spec_tc_success_prelude_Text_concat_1, "prelude/Text/concat/1"); + // tc_success!(spec_tc_success_prelude_Text_concatMap_0, "prelude/Text/concatMap/0"); + // tc_success!(spec_tc_success_prelude_Text_concatMap_1, "prelude/Text/concatMap/1"); + // tc_success!(spec_tc_success_prelude_Text_concatMapSep_0, "prelude/Text/concatMapSep/0"); + // tc_success!(spec_tc_success_prelude_Text_concatMapSep_1, "prelude/Text/concatMapSep/1"); + // tc_success!(spec_tc_success_prelude_Text_concatSep_0, "prelude/Text/concatSep/0"); + // tc_success!(spec_tc_success_prelude_Text_concatSep_1, "prelude/Text/concatSep/1"); + // tc_success!(spec_tc_success_recordOfRecordOfTypes, "recordOfRecordOfTypes"); + // tc_success!(spec_tc_success_recordOfTypes, "recordOfTypes"); + // tc_success!(spec_tc_success_simple_access_0, "simple/access/0"); + // tc_success!(spec_tc_success_simple_access_1, "simple/access/1"); + // tc_success!(spec_tc_success_simple_alternativesAreTypes, "simple/alternativesAreTypes"); + // tc_success!(spec_tc_success_simple_anonymousFunctionsInTypes, "simple/anonymousFunctionsInTypes"); + // tc_success!(spec_tc_success_simple_fieldsAreTypes, "simple/fieldsAreTypes"); + // tc_success!(spec_tc_success_simple_kindParameter, "simple/kindParameter"); + // tc_success!(spec_tc_success_simple_mergeEquivalence, "simple/mergeEquivalence"); + // tc_success!(spec_tc_success_simple_mixedFieldAccess, "simple/mixedFieldAccess"); + // tc_success!(spec_tc_success_simple_unionsOfTypes, "simple/unionsOfTypes"); + + // tc_failure!(spec_tc_failure_combineMixedRecords, "combineMixedRecords"); + // tc_failure!(spec_tc_failure_duplicateFields, "duplicateFields"); + // tc_failure!(spec_tc_failure_hurkensParadox, "hurkensParadox"); + + // ti_success!(spec_ti_success_simple_alternativesAreTypes, "simple/alternativesAreTypes"); + // ti_success!(spec_ti_success_simple_kindParameter, "simple/kindParameter"); + ti_success!(spec_ti_success_unit_Bool, "unit/Bool"); + ti_success!(spec_ti_success_unit_Double, "unit/Double"); + ti_success!(spec_ti_success_unit_DoubleLiteral, "unit/DoubleLiteral"); + // ti_success!(spec_ti_success_unit_DoubleShow, "unit/DoubleShow"); + ti_success!(spec_ti_success_unit_False, "unit/False"); + ti_success!(spec_ti_success_unit_Function, "unit/Function"); + ti_success!(spec_ti_success_unit_FunctionApplication, "unit/FunctionApplication"); + ti_success!(spec_ti_success_unit_FunctionNamedArg, "unit/FunctionNamedArg"); + // ti_success!(spec_ti_success_unit_FunctionTypeKindKind, "unit/FunctionTypeKindKind"); + // ti_success!(spec_ti_success_unit_FunctionTypeKindTerm, "unit/FunctionTypeKindTerm"); + // ti_success!(spec_ti_success_unit_FunctionTypeKindType, "unit/FunctionTypeKindType"); + ti_success!(spec_ti_success_unit_FunctionTypeTermTerm, "unit/FunctionTypeTermTerm"); + ti_success!(spec_ti_success_unit_FunctionTypeTypeTerm, "unit/FunctionTypeTypeTerm"); + ti_success!(spec_ti_success_unit_FunctionTypeTypeType, "unit/FunctionTypeTypeType"); + ti_success!(spec_ti_success_unit_FunctionTypeUsingArgument, "unit/FunctionTypeUsingArgument"); + ti_success!(spec_ti_success_unit_If, "unit/If"); + ti_success!(spec_ti_success_unit_IfNormalizeArguments, "unit/IfNormalizeArguments"); + ti_success!(spec_ti_success_unit_Integer, "unit/Integer"); + ti_success!(spec_ti_success_unit_IntegerLiteral, "unit/IntegerLiteral"); + // ti_success!(spec_ti_success_unit_IntegerShow, "unit/IntegerShow"); + // ti_success!(spec_ti_success_unit_IntegerToDouble, "unit/IntegerToDouble"); + // ti_success!(spec_ti_success_unit_Kind, "unit/Kind"); + ti_success!(spec_ti_success_unit_Let, "unit/Let"); + // ti_success!(spec_ti_success_unit_LetNestedTypeSynonym, "unit/LetNestedTypeSynonym"); + // ti_success!(spec_ti_success_unit_LetTypeSynonym, "unit/LetTypeSynonym"); + ti_success!(spec_ti_success_unit_LetWithAnnotation, "unit/LetWithAnnotation"); + ti_success!(spec_ti_success_unit_List, "unit/List"); + ti_success!(spec_ti_success_unit_ListBuild, "unit/ListBuild"); + ti_success!(spec_ti_success_unit_ListFold, "unit/ListFold"); + ti_success!(spec_ti_success_unit_ListHead, "unit/ListHead"); + ti_success!(spec_ti_success_unit_ListIndexed, "unit/ListIndexed"); + ti_success!(spec_ti_success_unit_ListLast, "unit/ListLast"); + ti_success!(spec_ti_success_unit_ListLength, "unit/ListLength"); + ti_success!(spec_ti_success_unit_ListLiteralEmpty, "unit/ListLiteralEmpty"); + ti_success!(spec_ti_success_unit_ListLiteralNormalizeArguments, "unit/ListLiteralNormalizeArguments"); + ti_success!(spec_ti_success_unit_ListLiteralOne, "unit/ListLiteralOne"); + ti_success!(spec_ti_success_unit_ListReverse, "unit/ListReverse"); + // ti_success!(spec_ti_success_unit_MergeEmptyUnion, "unit/MergeEmptyUnion"); + // ti_success!(spec_ti_success_unit_MergeOne, "unit/MergeOne"); + // ti_success!(spec_ti_success_unit_MergeOneWithAnnotation, "unit/MergeOneWithAnnotation"); + ti_success!(spec_ti_success_unit_Natural, "unit/Natural"); + ti_success!(spec_ti_success_unit_NaturalBuild, "unit/NaturalBuild"); + ti_success!(spec_ti_success_unit_NaturalEven, "unit/NaturalEven"); + ti_success!(spec_ti_success_unit_NaturalFold, "unit/NaturalFold"); + ti_success!(spec_ti_success_unit_NaturalIsZero, "unit/NaturalIsZero"); + ti_success!(spec_ti_success_unit_NaturalLiteral, "unit/NaturalLiteral"); + ti_success!(spec_ti_success_unit_NaturalOdd, "unit/NaturalOdd"); + // ti_success!(spec_ti_success_unit_NaturalShow, "unit/NaturalShow"); + // ti_success!(spec_ti_success_unit_NaturalToInteger, "unit/NaturalToInteger"); + // ti_success!(spec_ti_success_unit_None, "unit/None"); + ti_success!(spec_ti_success_unit_OldOptionalNone, "unit/OldOptionalNone"); + // ti_success!(spec_ti_success_unit_OldOptionalTrue, "unit/OldOptionalTrue"); + ti_success!(spec_ti_success_unit_OperatorAnd, "unit/OperatorAnd"); + ti_success!(spec_ti_success_unit_OperatorAndNormalizeArguments, "unit/OperatorAndNormalizeArguments"); + ti_success!(spec_ti_success_unit_OperatorEqual, "unit/OperatorEqual"); + ti_success!(spec_ti_success_unit_OperatorEqualNormalizeArguments, "unit/OperatorEqualNormalizeArguments"); + // ti_success!(spec_ti_success_unit_OperatorListConcatenate, "unit/OperatorListConcatenate"); + // ti_success!(spec_ti_success_unit_OperatorListConcatenateNormalizeArguments, "unit/OperatorListConcatenateNormalizeArguments"); + ti_success!(spec_ti_success_unit_OperatorNotEqual, "unit/OperatorNotEqual"); + ti_success!(spec_ti_success_unit_OperatorNotEqualNormalizeArguments, "unit/OperatorNotEqualNormalizeArguments"); + ti_success!(spec_ti_success_unit_OperatorOr, "unit/OperatorOr"); + ti_success!(spec_ti_success_unit_OperatorOrNormalizeArguments, "unit/OperatorOrNormalizeArguments"); + ti_success!(spec_ti_success_unit_OperatorPlus, "unit/OperatorPlus"); + ti_success!(spec_ti_success_unit_OperatorPlusNormalizeArguments, "unit/OperatorPlusNormalizeArguments"); + ti_success!(spec_ti_success_unit_OperatorTextConcatenate, "unit/OperatorTextConcatenate"); + ti_success!(spec_ti_success_unit_OperatorTextConcatenateNormalizeArguments, "unit/OperatorTextConcatenateNormalizeArguments"); + ti_success!(spec_ti_success_unit_OperatorTimes, "unit/OperatorTimes"); + ti_success!(spec_ti_success_unit_OperatorTimesNormalizeArguments, "unit/OperatorTimesNormalizeArguments"); + ti_success!(spec_ti_success_unit_Optional, "unit/Optional"); + // ti_success!(spec_ti_success_unit_OptionalBuild, "unit/OptionalBuild"); + ti_success!(spec_ti_success_unit_OptionalFold, "unit/OptionalFold"); + ti_success!(spec_ti_success_unit_RecordEmpty, "unit/RecordEmpty"); + // ti_success!(spec_ti_success_unit_RecordOneKind, "unit/RecordOneKind"); + // ti_success!(spec_ti_success_unit_RecordOneType, "unit/RecordOneType"); + ti_success!(spec_ti_success_unit_RecordOneValue, "unit/RecordOneValue"); + // ti_success!(spec_ti_success_unit_RecordProjectionEmpty, "unit/RecordProjectionEmpty"); + // ti_success!(spec_ti_success_unit_RecordProjectionKind, "unit/RecordProjectionKind"); + // ti_success!(spec_ti_success_unit_RecordProjectionType, "unit/RecordProjectionType"); + // ti_success!(spec_ti_success_unit_RecordProjectionValue, "unit/RecordProjectionValue"); + // ti_success!(spec_ti_success_unit_RecordSelectionKind, "unit/RecordSelectionKind"); + // ti_success!(spec_ti_success_unit_RecordSelectionType, "unit/RecordSelectionType"); + ti_success!(spec_ti_success_unit_RecordSelectionValue, "unit/RecordSelectionValue"); + ti_success!(spec_ti_success_unit_RecordType, "unit/RecordType"); + ti_success!(spec_ti_success_unit_RecordTypeEmpty, "unit/RecordTypeEmpty"); + // ti_success!(spec_ti_success_unit_RecordTypeKind, "unit/RecordTypeKind"); + // ti_success!(spec_ti_success_unit_RecordTypeType, "unit/RecordTypeType"); + // ti_success!(spec_ti_success_unit_RecursiveRecordMergeLhsEmpty, "unit/RecursiveRecordMergeLhsEmpty"); + // ti_success!(spec_ti_success_unit_RecursiveRecordMergeRecursively, "unit/RecursiveRecordMergeRecursively"); + // ti_success!(spec_ti_success_unit_RecursiveRecordMergeRecursivelyTypes, "unit/RecursiveRecordMergeRecursivelyTypes"); + // ti_success!(spec_ti_success_unit_RecursiveRecordMergeRhsEmpty, "unit/RecursiveRecordMergeRhsEmpty"); + // ti_success!(spec_ti_success_unit_RecursiveRecordMergeTwo, "unit/RecursiveRecordMergeTwo"); + // ti_success!(spec_ti_success_unit_RecursiveRecordMergeTwoKinds, "unit/RecursiveRecordMergeTwoKinds"); + // ti_success!(spec_ti_success_unit_RecursiveRecordMergeTwoTypes, "unit/RecursiveRecordMergeTwoTypes"); + // ti_success!(spec_ti_success_unit_RecursiveRecordTypeMergeRecursively, "unit/RecursiveRecordTypeMergeRecursively"); + // ti_success!(spec_ti_success_unit_RecursiveRecordTypeMergeRecursivelyTypes, "unit/RecursiveRecordTypeMergeRecursivelyTypes"); + // ti_success!(spec_ti_success_unit_RecursiveRecordTypeMergeRhsEmpty, "unit/RecursiveRecordTypeMergeRhsEmpty"); + // ti_success!(spec_ti_success_unit_RecursiveRecordTypeMergeTwo, "unit/RecursiveRecordTypeMergeTwo"); + // ti_success!(spec_ti_success_unit_RecursiveRecordTypeMergeTwoKinds, "unit/RecursiveRecordTypeMergeTwoKinds"); + // ti_success!(spec_ti_success_unit_RecursiveRecordTypeMergeTwoTypes, "unit/RecursiveRecordTypeMergeTwoTypes"); + // ti_success!(spec_ti_success_unit_RightBiasedRecordMergeRhsEmpty, "unit/RightBiasedRecordMergeRhsEmpty"); + // ti_success!(spec_ti_success_unit_RightBiasedRecordMergeTwo, "unit/RightBiasedRecordMergeTwo"); + // ti_success!(spec_ti_success_unit_RightBiasedRecordMergeTwoDifferent, "unit/RightBiasedRecordMergeTwoDifferent"); + // ti_success!(spec_ti_success_unit_RightBiasedRecordMergeTwoKinds, "unit/RightBiasedRecordMergeTwoKinds"); + // ti_success!(spec_ti_success_unit_RightBiasedRecordMergeTwoTypes, "unit/RightBiasedRecordMergeTwoTypes"); + ti_success!(spec_ti_success_unit_SomeTrue, "unit/SomeTrue"); + ti_success!(spec_ti_success_unit_Text, "unit/Text"); + ti_success!(spec_ti_success_unit_TextLiteral, "unit/TextLiteral"); + ti_success!(spec_ti_success_unit_TextLiteralNormalizeArguments, "unit/TextLiteralNormalizeArguments"); + ti_success!(spec_ti_success_unit_TextLiteralWithInterpolation, "unit/TextLiteralWithInterpolation"); + // ti_success!(spec_ti_success_unit_TextShow, "unit/TextShow"); + ti_success!(spec_ti_success_unit_True, "unit/True"); + ti_success!(spec_ti_success_unit_Type, "unit/Type"); + ti_success!(spec_ti_success_unit_TypeAnnotation, "unit/TypeAnnotation"); + // ti_success!(spec_ti_success_unit_UnionConstructorField, "unit/UnionConstructorField"); + // ti_success!(spec_ti_success_unit_UnionOne, "unit/UnionOne"); + // ti_success!(spec_ti_success_unit_UnionTypeEmpty, "unit/UnionTypeEmpty"); + // ti_success!(spec_ti_success_unit_UnionTypeKind, "unit/UnionTypeKind"); + // ti_success!(spec_ti_success_unit_UnionTypeOne, "unit/UnionTypeOne"); + // ti_success!(spec_ti_success_unit_UnionTypeType, "unit/UnionTypeType"); +} |