├── .cargo └── config.toml ├── .gitattributes ├── .github ├── actions │ ├── rust-toolchain │ │ └── action.yaml │ ├── setup-haskell │ │ └── action.yaml │ └── setup-rust │ │ └── action.yaml └── workflows │ ├── ci.yaml │ ├── release.yaml │ └── security-audit.yaml ├── .gitignore ├── .husky ├── pre-commit └── pre-push ├── .nvmrc ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── cargo-llvm-cov-cargo-lock.patch ├── crates ├── ditto-ast │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── expression.rs │ │ ├── graph.rs │ │ ├── kind.rs │ │ ├── lib.rs │ │ ├── module.rs │ │ ├── name.rs │ │ ├── type.rs │ │ └── var.rs ├── ditto-checker │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── bin │ │ │ └── ditto-checker-testbin-check-module.rs │ │ ├── collections.rs │ │ ├── kindchecker │ │ │ ├── env.rs │ │ │ ├── mod.rs │ │ │ ├── state.rs │ │ │ ├── substitution.rs │ │ │ └── tests │ │ │ │ ├── macros.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── prim.rs │ │ │ │ └── variable.rs │ │ ├── lib.rs │ │ ├── module │ │ │ ├── common.rs │ │ │ ├── exports │ │ │ │ └── mod.rs │ │ │ ├── foreign_value_declarations │ │ │ │ └── mod.rs │ │ │ ├── imports │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── type_declarations │ │ │ │ ├── mod.rs │ │ │ │ └── tests │ │ │ │ │ ├── acyclic.rs │ │ │ │ │ ├── macros.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── toposort.rs │ │ │ └── value_declarations │ │ │ │ ├── mod.rs │ │ │ │ └── tests │ │ │ │ ├── acyclic.rs │ │ │ │ ├── macros.rs │ │ │ │ ├── mod.rs │ │ │ │ └── toposort.rs │ │ ├── result │ │ │ ├── mod.rs │ │ │ ├── type_error.rs │ │ │ └── warnings.rs │ │ ├── supply.rs │ │ └── typechecker │ │ │ ├── common.rs │ │ │ ├── coverage │ │ │ ├── mod.rs │ │ │ └── tests.rs │ │ │ ├── env.rs │ │ │ ├── mod.rs │ │ │ ├── pre_ast.rs │ │ │ ├── scheme.rs │ │ │ ├── state.rs │ │ │ ├── substitution.rs │ │ │ ├── tests │ │ │ ├── array.rs │ │ │ ├── bool.rs │ │ │ ├── call.rs │ │ │ ├── cond.rs │ │ │ ├── effect.rs │ │ │ ├── float.rs │ │ │ ├── function.rs │ │ │ ├── int.rs │ │ │ ├── let.rs │ │ │ ├── macros.rs │ │ │ ├── match.rs │ │ │ ├── mod.rs │ │ │ ├── records.rs │ │ │ ├── right_pipe.rs │ │ │ ├── string.rs │ │ │ └── unit.rs │ │ │ └── toposort.rs │ └── tests │ │ ├── cmd │ │ ├── .ignore │ │ ├── always_partial_application │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── array_alias │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── array_alias_chain │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── array_int_alias_error │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── basic_task_module │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── closed_record_alias │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── cyclic_type_alias_error │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── cyclic_types │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── cyclic_types_error │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── cyclic_values │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── cyclic_values_error │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── directly_unused_foreign_value │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_import_alias │ │ │ ├── test.in │ │ │ │ ├── Bar.ditto │ │ │ │ └── Foo.ditto │ │ │ ├── test.out │ │ │ │ ├── Bar.ast │ │ │ │ └── Foo.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_import_line │ │ │ ├── test.in │ │ │ │ └── Dep.ditto │ │ │ ├── test.out │ │ │ │ └── Dep.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_import_module_name │ │ │ ├── test.in │ │ │ │ ├── bar │ │ │ │ │ └── A.ditto │ │ │ │ └── foo │ │ │ │ │ └── A.ditto │ │ │ ├── test.out │ │ │ │ ├── bar │ │ │ │ │ └── A.ast │ │ │ │ └── foo │ │ │ │ │ └── A.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_same_type_constructor │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_type_constructor │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_type_declaration │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_type_export │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_type_export_with_different_visibility │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_type_import │ │ │ ├── test.in │ │ │ │ └── Maybe.ditto │ │ │ ├── test.out │ │ │ │ └── Maybe.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_type_import_with_different_visibility │ │ │ ├── test.in │ │ │ │ └── Maybe.ditto │ │ │ ├── test.out │ │ │ │ └── Maybe.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_value_declaration │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_value_export │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate_value_import │ │ │ ├── test.in │ │ │ │ └── Foo.ditto │ │ │ ├── test.out │ │ │ │ └── Foo.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── export_docs │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── float_alias │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── float_alias_chain │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── foreign_function_impl │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── foreign_value_impl │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── function_type_alias │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── homogeneous_type_alias_array │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── imported_bool_alias │ │ │ ├── test.in │ │ │ │ └── Boolean.ditto │ │ │ ├── test.out │ │ │ │ └── Boolean.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── imported_constructor_matching │ │ │ ├── test.in │ │ │ │ ├── Dep.ditto │ │ │ │ └── Maybe.ditto │ │ │ ├── test.out │ │ │ │ ├── Dep.ast │ │ │ │ └── Maybe.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── indirectly_unused_foreign_value │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── let_destructure_not_exhaustive_error │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── let_destructuring │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── let_not_in_scope_error │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── let_recursive_error │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── let_unused_warning │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── maybe_int_alias │ │ │ ├── test.in │ │ │ │ └── Maybe.ditto │ │ │ ├── test.out │ │ │ │ └── Maybe.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── mini_vdom │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── module_not_found │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── never │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── open_record_alias │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── open_record_alias_chain │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── open_record_alias_chain_error │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── open_record_alias_error │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── option_alias │ │ │ ├── test.in │ │ │ │ └── base │ │ │ │ │ └── Maybe.ditto │ │ │ ├── test.out │ │ │ │ └── base │ │ │ │ │ └── Maybe.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── package_not_found │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── private_type_constructors_import │ │ │ ├── test.in │ │ │ │ └── Dep.ditto │ │ │ ├── test.out │ │ │ │ └── Dep.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── rebound_import_constructors │ │ │ ├── test.in │ │ │ │ ├── Bar.ditto │ │ │ │ └── Foo.ditto │ │ │ ├── test.out │ │ │ │ ├── Bar.ast │ │ │ │ └── Foo.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── rebound_import_type │ │ │ ├── test.in │ │ │ │ ├── Bar.ditto │ │ │ │ └── Foo.ditto │ │ │ ├── test.out │ │ │ │ ├── Bar.ast │ │ │ │ └── Foo.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── rebound_import_value │ │ │ ├── test.in │ │ │ │ ├── Bar.ditto │ │ │ │ └── Foo.ditto │ │ │ ├── test.out │ │ │ │ ├── Bar.ast │ │ │ │ └── Foo.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── record_extension_newtype │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── refutable_function_binder │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── result_alias_effect_matching │ │ │ ├── test.in │ │ │ │ └── Result.ditto │ │ │ ├── test.out │ │ │ │ └── Result.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── result_alias_matching │ │ │ ├── test.in │ │ │ │ └── Result.ditto │ │ │ ├── test.out │ │ │ │ └── Result.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── self_referencing_function_error │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── simple_type_imports │ │ │ ├── test.in │ │ │ │ └── Maybe.ditto │ │ │ ├── test.out │ │ │ │ └── Maybe.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── simple_value_imports │ │ │ ├── test.in │ │ │ │ └── Foo.ditto │ │ │ ├── test.out │ │ │ │ └── Foo.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── template.sh │ │ ├── unknown_type_export │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── unknown_type_import │ │ │ ├── test.in │ │ │ │ └── Dep.ditto │ │ │ ├── test.out │ │ │ │ └── Dep.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── unknown_value_export │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── unknown_value_import │ │ │ ├── test.in │ │ │ │ └── Dep.ditto │ │ │ ├── test.out │ │ │ │ └── Dep.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── unused_import_line │ │ │ ├── test.in │ │ │ │ └── Dep.ditto │ │ │ ├── test.out │ │ │ │ └── Dep.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── unused_package_import_line │ │ │ ├── test.in │ │ │ │ └── pkg │ │ │ │ │ └── Dep.ditto │ │ │ ├── test.out │ │ │ │ └── pkg │ │ │ │ │ └── Dep.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── unused_type_constructors │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── unused_type_declaration │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── unused_unqualified_type_import │ │ │ ├── test.in │ │ │ │ └── Five.ditto │ │ │ ├── test.out │ │ │ │ └── Five.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── unused_unqualified_value_import │ │ │ ├── test.in │ │ │ │ └── Five.ditto │ │ │ ├── test.out │ │ │ │ └── Five.ast │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── unused_value_declaration │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── variable_alias │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ └── verify.py │ │ ├── common.rs │ │ ├── golden │ │ ├── type-errors │ │ │ ├── argument_length_mismatch_0.ditto │ │ │ ├── argument_length_mismatch_0.error │ │ │ ├── argument_length_mismatch_1.ditto │ │ │ ├── argument_length_mismatch_1.error │ │ │ ├── argument_length_mismatch_2.ditto │ │ │ ├── argument_length_mismatch_2.error │ │ │ ├── argument_length_mismatch_3.ditto │ │ │ ├── argument_length_mismatch_3.error │ │ │ ├── duplicate_function_binder.ditto │ │ │ ├── duplicate_function_binder.error │ │ │ ├── duplicate_import_line.ditto │ │ │ ├── duplicate_import_line.error │ │ │ ├── duplicate_import_module_0.ditto │ │ │ ├── duplicate_import_module_0.error │ │ │ ├── duplicate_import_module_1.ditto │ │ │ ├── duplicate_import_module_1.error │ │ │ ├── duplicate_pattern_binder.ditto │ │ │ ├── duplicate_pattern_binder.error │ │ │ ├── duplicate_type_declaration.ditto │ │ │ ├── duplicate_type_declaration.error │ │ │ ├── duplicate_type_declaration_constructor.ditto │ │ │ ├── duplicate_type_declaration_constructor.error │ │ │ ├── duplicate_type_declaration_variable.ditto │ │ │ ├── duplicate_type_declaration_variable.error │ │ │ ├── duplicate_value_declaration.ditto │ │ │ ├── duplicate_value_declaration.error │ │ │ ├── effect_unification_error_0.ditto │ │ │ ├── effect_unification_error_0.error │ │ │ ├── infinite_type.ditto │ │ │ ├── infinite_type.error │ │ │ ├── kind_unification_error_1.ditto │ │ │ ├── kind_unification_error_1.error │ │ │ ├── match_not_exhaustive_0.ditto │ │ │ ├── match_not_exhaustive_0.error │ │ │ ├── match_not_exhaustive_1.ditto │ │ │ ├── match_not_exhaustive_1.error │ │ │ ├── match_unification_error_0.ditto │ │ │ ├── match_unification_error_0.error │ │ │ ├── match_unification_error_1.ditto │ │ │ ├── match_unification_error_1.error │ │ │ ├── match_unification_error_2.ditto │ │ │ ├── match_unification_error_2.error │ │ │ ├── match_unification_error_3.ditto │ │ │ ├── match_unification_error_3.error │ │ │ ├── match_unification_error_4.ditto │ │ │ ├── match_unification_error_4.error │ │ │ ├── match_unification_error_5.ditto │ │ │ ├── match_unification_error_5.error │ │ │ ├── match_unification_error_6.ditto │ │ │ ├── match_unification_error_6.error │ │ │ ├── module_not_found.ditto │ │ │ ├── module_not_found.error │ │ │ ├── module_not_found_in_package.ditto │ │ │ ├── module_not_found_in_package.error │ │ │ ├── no_visible_constructors.ditto │ │ │ ├── no_visible_constructors.error │ │ │ ├── not_a_function_0.ditto │ │ │ ├── not_a_function_0.error │ │ │ ├── not_a_function_1.ditto │ │ │ ├── not_a_function_1.error │ │ │ ├── package_not_found.ditto │ │ │ ├── package_not_found.error │ │ │ ├── rebound_import_constructor.ditto │ │ │ ├── rebound_import_constructor.error │ │ │ ├── rebound_import_type.ditto │ │ │ ├── rebound_import_type.error │ │ │ ├── rebound_import_value.ditto │ │ │ ├── rebound_import_value.error │ │ │ ├── record_unification_error_0.ditto │ │ │ ├── record_unification_error_0.error │ │ │ ├── row_unification_error_0.ditto │ │ │ ├── row_unification_error_0.error │ │ │ ├── row_unification_error_1.ditto │ │ │ ├── row_unification_error_1.error │ │ │ ├── type_argument_length_mismatch_0.ditto │ │ │ ├── type_argument_length_mismatch_0.error │ │ │ ├── type_not_a_function_0.ditto │ │ │ ├── type_not_a_function_0.error │ │ │ ├── unification_error_0.ditto │ │ │ ├── unification_error_0.error │ │ │ ├── unification_error_1.ditto │ │ │ ├── unification_error_1.error │ │ │ ├── unification_error_2.ditto │ │ │ ├── unification_error_2.error │ │ │ ├── unification_error_3.ditto │ │ │ ├── unification_error_3.error │ │ │ ├── unification_error_4.ditto │ │ │ ├── unification_error_4.error │ │ │ ├── unknown_constructor.ditto │ │ │ ├── unknown_constructor.error │ │ │ ├── unknown_constructor_qualified.ditto │ │ │ ├── unknown_constructor_qualified.error │ │ │ ├── unknown_constructor_typo.ditto │ │ │ ├── unknown_constructor_typo.error │ │ │ ├── unknown_type_constructor.ditto │ │ │ ├── unknown_type_constructor.error │ │ │ ├── unknown_type_export.ditto │ │ │ ├── unknown_type_export.error │ │ │ ├── unknown_type_import.ditto │ │ │ ├── unknown_type_import.error │ │ │ ├── unknown_type_variable.ditto │ │ │ ├── unknown_type_variable.error │ │ │ ├── unknown_value_export.ditto │ │ │ ├── unknown_value_export.error │ │ │ ├── unknown_value_import.ditto │ │ │ ├── unknown_value_import.error │ │ │ ├── unknown_variable.ditto │ │ │ ├── unknown_variable.error │ │ │ ├── unknown_variable_qualified.ditto │ │ │ ├── unknown_variable_qualified.error │ │ │ ├── unknown_variable_typo.ditto │ │ │ └── unknown_variable_typo.error │ │ └── warnings │ │ │ ├── duplicate_type_export.ditto │ │ │ ├── duplicate_type_export.warnings │ │ │ ├── duplicate_type_import.ditto │ │ │ ├── duplicate_type_import.warnings │ │ │ ├── duplicate_value_export.ditto │ │ │ ├── duplicate_value_export.warnings │ │ │ ├── duplicate_value_import.ditto │ │ │ ├── duplicate_value_import.warnings │ │ │ ├── redundant_pattern_0.ditto │ │ │ ├── redundant_pattern_0.warnings │ │ │ ├── redundant_pattern_1.ditto │ │ │ ├── redundant_pattern_1.warnings │ │ │ ├── redundant_patterns.ditto │ │ │ ├── redundant_patterns.warnings │ │ │ ├── unused_effect_binder.ditto │ │ │ ├── unused_effect_binder.warnings │ │ │ ├── unused_foreign_value.ditto │ │ │ ├── unused_foreign_value.warnings │ │ │ ├── unused_function_binder.ditto │ │ │ ├── unused_function_binder.warnings │ │ │ ├── unused_import.ditto │ │ │ ├── unused_import.warnings │ │ │ ├── unused_pattern_binder.ditto │ │ │ ├── unused_pattern_binder.warnings │ │ │ ├── unused_type_constructors.ditto │ │ │ ├── unused_type_constructors.warnings │ │ │ ├── unused_type_declaration.ditto │ │ │ ├── unused_type_declaration.warnings │ │ │ ├── unused_value_declaration.ditto │ │ │ └── unused_value_declaration.warnings │ │ ├── golden_error_tests.rs │ │ ├── golden_warning_tests.rs │ │ └── trycmd_tests.rs ├── ditto-cli │ ├── Cargo.toml │ ├── README.md │ ├── build.rs │ ├── src │ │ ├── bootstrap.rs │ │ ├── common.rs │ │ ├── fmt.rs │ │ ├── lsp.rs │ │ ├── main.rs │ │ ├── make.rs │ │ ├── ninja.rs │ │ ├── pkg.rs │ │ ├── spinner.rs │ │ └── version.rs │ └── tests │ │ ├── cmd │ │ ├── .ignore │ │ ├── bootstrap_custom_name │ │ │ ├── test.out │ │ │ │ └── vanilla-pkg │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── ditto-src │ │ │ │ │ └── Custom.ditto │ │ │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── bootstrap_dir_exists │ │ │ ├── test.in │ │ │ │ └── vanilla-pkg │ │ │ │ │ └── .keep │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── bootstrap_invalid_package_name │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── bootstrap_invalid_package_name_from_dir │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── bootstrap_javascript │ │ │ ├── test.out │ │ │ │ └── js-pkg │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── ditto-src │ │ │ │ │ └── JsPkg.ditto │ │ │ │ │ ├── ditto.toml │ │ │ │ │ └── package.json │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── bootstrap_nested_dir │ │ │ ├── test.out │ │ │ │ └── pkgs │ │ │ │ │ └── vanilla-pkg │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── ditto-src │ │ │ │ │ └── VanillaPkg.ditto │ │ │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── bootstrap_vanilla │ │ │ ├── test.out │ │ │ │ └── vanilla-pkg │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── ditto-src │ │ │ │ │ └── VanillaPkg.ditto │ │ │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── fmt_both_files_and_stdin │ │ │ ├── test.in │ │ │ │ ├── Bar.ditto │ │ │ │ └── Foo.ditto │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── fmt_file_check_error │ │ │ ├── test.in │ │ │ │ └── Foo.ditto │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── fmt_files │ │ │ ├── test.in │ │ │ │ ├── Bar.ditto │ │ │ │ └── Foo.ditto │ │ │ ├── test.out │ │ │ │ ├── Bar.ditto │ │ │ │ └── Foo.ditto │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── fmt_stdin │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── fmt_stdin_check_error │ │ │ ├── test.stderr │ │ │ ├── test.stdin │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── make_check │ │ │ ├── test.in │ │ │ │ ├── .gitignore │ │ │ │ ├── ditto-src │ │ │ │ │ └── VanillaPkg.ditto │ │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── make_javascript │ │ │ ├── test.in │ │ │ │ ├── .gitignore │ │ │ │ ├── ditto-src │ │ │ │ │ └── JsPkg.ditto │ │ │ │ ├── ditto.toml │ │ │ │ └── package.json │ │ │ ├── test.out │ │ │ │ └── dist │ │ │ │ │ └── JsPkg.js │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ └── version │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ └── trycmd_tests.rs ├── ditto-codegen-js │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── ast.rs │ │ ├── convert.rs │ │ ├── lib.rs │ │ ├── optimize │ │ │ ├── mod.rs │ │ │ └── rewrites.rs │ │ └── render.rs │ └── tests │ │ ├── golden │ │ ├── basic_expressions.ditto │ │ ├── basic_expressions.js │ │ ├── complex_if.ditto │ │ ├── complex_if.js │ │ ├── effect_expressions.ditto │ │ ├── effect_expressions.js │ │ ├── foreign_impls.ditto │ │ ├── foreign_impls.js │ │ ├── imports.ditto │ │ ├── imports.js │ │ ├── irrefutable_argument_patterns.ditto │ │ ├── irrefutable_argument_patterns.js │ │ ├── keyword_mangling.ditto │ │ ├── keyword_mangling.js │ │ ├── let_expressions.ditto │ │ ├── let_expressions.js │ │ ├── match_expressions.ditto │ │ ├── match_expressions.js │ │ ├── number_literals.ditto │ │ ├── number_literals.js │ │ ├── objects.ditto │ │ ├── objects.js │ │ ├── pipe_expressions.ditto │ │ ├── pipe_expressions.js │ │ ├── recursive_constants.ditto │ │ ├── recursive_constants.js │ │ ├── recursive_functions.ditto │ │ ├── recursive_functions.js │ │ ├── strings.ditto │ │ ├── strings.js │ │ ├── type_declarations.ditto │ │ ├── type_declarations.js │ │ ├── unused_patterns.ditto │ │ └── unused_patterns.js │ │ ├── golden_tests.rs │ │ └── node_execution_tests.rs ├── ditto-config │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── lib.rs │ │ ├── package_set.rs │ │ └── tests.rs │ └── tests │ │ ├── golden │ │ └── parse-errors │ │ │ ├── bad_target.error │ │ │ ├── bad_target.toml │ │ │ ├── missing_name.error │ │ │ ├── missing_name.toml │ │ │ ├── syntax_error_0.error │ │ │ ├── syntax_error_0.toml │ │ │ ├── syntax_error_1.error │ │ │ └── syntax_error_1.toml │ │ └── golden_tests.rs ├── ditto-cst │ ├── Cargo.toml │ ├── README.md │ ├── benches │ │ └── expressions.rs │ ├── build.rs │ ├── src │ │ ├── ditto.lalrpop │ │ ├── expression.rs │ │ ├── get_span.rs │ │ ├── lexer.rs │ │ ├── lib.rs │ │ ├── module.rs │ │ ├── name.rs │ │ ├── parser │ │ │ ├── mod.rs │ │ │ └── tests │ │ │ │ ├── declaration.rs │ │ │ │ ├── expression.rs │ │ │ │ ├── imports.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── module_header.rs │ │ │ │ ├── partials.rs │ │ │ │ └── type.rs │ │ ├── syntax.rs │ │ ├── token.rs │ │ └── type.rs │ └── tests │ │ ├── golden │ │ └── parse-errors │ │ │ ├── bad_package_name.ditto │ │ │ ├── bad_package_name.error │ │ │ ├── empty_input.ditto │ │ │ ├── empty_input.error │ │ │ ├── partial_module_header.ditto │ │ │ └── partial_module_header.error │ │ └── golden_tests.rs ├── ditto-fmt │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── config.rs │ │ ├── declaration.rs │ │ ├── expression.rs │ │ ├── has_comments.rs │ │ ├── helpers.rs │ │ ├── lib.rs │ │ ├── module.rs │ │ ├── name.rs │ │ ├── syntax.rs │ │ ├── token.rs │ │ └── type.rs │ └── tests │ │ ├── golden │ │ ├── effect_expressions.ditto │ │ ├── empty_module.ditto │ │ ├── empty_module_with_trailing_comments.ditto │ │ ├── if_then_else.ditto │ │ ├── import_sorting.ditto │ │ ├── kitchen_sink.ditto │ │ ├── let_expressions.ditto │ │ ├── match_expressions.ditto │ │ ├── newtypes.ditto │ │ ├── pipe_expressions.ditto │ │ ├── records.ditto │ │ ├── type_aliases.ditto │ │ ├── type_declarations.ditto │ │ └── value_declarations.ditto │ │ └── golden_tests.rs ├── ditto-highlight │ ├── Cargo.toml │ ├── src │ │ └── lib.rs │ └── tests │ │ ├── golden │ │ ├── brackets.ditto │ │ ├── brackets.html │ │ ├── delimiters.ditto │ │ ├── delimiters.html │ │ ├── functions.ditto │ │ ├── functions.html │ │ ├── keywords-conditional.ditto │ │ ├── keywords-conditional.html │ │ ├── keywords-import.ditto │ │ ├── keywords-import.html │ │ ├── keywords.ditto │ │ ├── keywords.html │ │ ├── literals.ditto │ │ ├── literals.html │ │ ├── members.ditto │ │ ├── members.html │ │ ├── namespace.ditto │ │ ├── namespace.html │ │ ├── operators.ditto │ │ ├── operators.html │ │ ├── parameters.ditto │ │ ├── parameters.html │ │ ├── symbols.ditto │ │ ├── symbols.html │ │ ├── types.ditto │ │ ├── types.html │ │ ├── variables.ditto │ │ └── variables.html │ │ └── golden_tests.rs ├── ditto-lsp │ ├── Cargo.toml │ ├── README.md │ ├── fixtures │ │ ├── .ignore │ │ ├── diagnostics-0 │ │ │ ├── ditto-src │ │ │ │ └── A.ditto │ │ │ ├── ditto.toml │ │ │ └── logs.txt │ │ ├── diagnostics-1 │ │ │ ├── .ditto │ │ │ │ └── packages │ │ │ │ │ └── core │ │ │ │ │ ├── ditto-src │ │ │ │ │ ├── B.ditto │ │ │ │ │ └── C.ditto │ │ │ │ │ └── ditto.toml │ │ │ ├── ditto-src │ │ │ │ └── A.ditto │ │ │ ├── ditto.toml │ │ │ └── logs.txt │ │ ├── formatting │ │ │ ├── Example.ditto │ │ │ └── logs.txt │ │ └── semantic-tokens │ │ │ ├── Example.ditto │ │ │ └── logs.txt │ ├── lsp-test │ │ ├── Main.hs │ │ └── ditto-lsp-test.cabal │ ├── src │ │ ├── bin │ │ │ └── ditto-lsp-testbin.rs │ │ ├── common.rs │ │ ├── db.rs │ │ ├── goto_definition.rs │ │ ├── hover.rs │ │ ├── lib.rs │ │ ├── locate.rs │ │ ├── semantic_tokens.rs │ │ └── test.rs │ └── tests │ │ └── lsp_test.rs ├── ditto-make │ ├── Cargo.toml │ ├── README.md │ ├── src │ │ ├── bin │ │ │ └── ditto-make-testbin.rs │ │ ├── build_ninja.rs │ │ ├── common.rs │ │ ├── compile.rs │ │ ├── lib.rs │ │ └── utils.rs │ └── tests │ │ ├── cmd │ │ ├── .ignore │ │ ├── all-good │ │ │ ├── test.in │ │ │ │ ├── dep │ │ │ │ │ ├── ditto-src │ │ │ │ │ │ ├── Dep.ditto │ │ │ │ │ │ └── Util.ditto │ │ │ │ │ └── ditto.toml │ │ │ │ ├── ditto-src │ │ │ │ │ ├── A.ditto │ │ │ │ │ ├── B.ditto │ │ │ │ │ ├── C.ditto │ │ │ │ │ ├── D.ditto │ │ │ │ │ └── D │ │ │ │ │ │ └── E.ditto │ │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── duplicate-module-name │ │ │ ├── test.in │ │ │ │ ├── ditto-src │ │ │ │ │ ├── A.ditto │ │ │ │ │ └── B.ditto │ │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── missing-module │ │ │ ├── test.in │ │ │ │ ├── ditto-src │ │ │ │ │ └── A.ditto │ │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── module-cycle │ │ │ ├── test.in │ │ │ │ ├── ditto-src │ │ │ │ │ ├── A.ditto │ │ │ │ │ └── B.ditto │ │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── no-codegen │ │ │ ├── test.in │ │ │ │ ├── build.ninja │ │ │ │ ├── dep │ │ │ │ │ ├── ditto-src │ │ │ │ │ │ └── Dep.ditto │ │ │ │ │ └── ditto.toml │ │ │ │ ├── ditto-src │ │ │ │ │ ├── A.ditto │ │ │ │ │ ├── B.ditto │ │ │ │ │ ├── C.ditto │ │ │ │ │ └── D.ditto │ │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── self-referencing-module │ │ │ ├── test.in │ │ │ │ ├── ditto-src │ │ │ │ │ └── A.ditto │ │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ ├── target-mismatch │ │ │ ├── test.in │ │ │ │ ├── dep │ │ │ │ │ ├── ditto-src │ │ │ │ │ │ └── Dep.ditto │ │ │ │ │ └── ditto.toml │ │ │ │ ├── ditto-src │ │ │ │ │ ├── A.ditto │ │ │ │ │ ├── B.ditto │ │ │ │ │ ├── C.ditto │ │ │ │ │ └── D.ditto │ │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ └── unsupported-ditto-version │ │ │ ├── test.in │ │ │ ├── ditto-src │ │ │ │ └── A.ditto │ │ │ └── ditto.toml │ │ │ ├── test.stderr │ │ │ ├── test.stdout │ │ │ └── test.toml │ │ └── trycmd_tests.rs └── ditto-tree-sitter │ ├── Cargo.toml │ ├── README.md │ ├── src │ └── lib.rs │ └── tests │ └── parsing_tests.rs ├── images └── hello-ditto.svg ├── nixpkgs.nix ├── package-lock.json ├── package.json ├── rust-toolchain.toml ├── rustfmt.toml ├── scripts ├── cargo-dupdeps.py ├── cst-generator │ ├── Main.hs │ └── cst-generator.cabal ├── dev.sh ├── list-executables.py ├── log-analysis │ ├── .gitignore │ ├── main.R │ └── shell.nix └── release │ ├── README.md │ ├── index.js │ ├── package-lock.json │ └── package.json ├── shell.nix ├── stack.yaml ├── stack.yaml.lock └── treefmt.toml /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [env] 2 | # https://github.com/rust-lang/cargo/issues/3946#issuecomment-973132993 3 | CARGO_WORKSPACE_DIR = { value = "", relative = true } 4 | 5 | [profile.test.package.dprint-core] 6 | # Started hitting this since dprint-core v0.59 7 | # https://github.com/dprint/dprint/blob/0788ba63640cf755f81a939c07f4bf94861c5bf0/crates/core/src/formatting/collections/vec_u32_map.rs#L168-L170 8 | debug-assertions = false -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Cargo 2 | target 3 | 4 | # Nix 5 | /result 6 | 7 | # NPM 8 | node_modules 9 | 10 | # Local benchmarks 11 | control.bench 12 | latest.bench 13 | 14 | # Haskell 15 | .stack-work 16 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # shellcheck source=/dev/null 3 | . "$(dirname "$0")/_/husky.sh" 4 | 5 | npx lint-staged 6 | -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # shellcheck source=/dev/null 3 | . "$(dirname "$0")/_/husky.sh" 4 | 5 | # If this fails, try running 6 | # cargo clippy --workspace --fix --allow-dirty --allow-staged 7 | cargo clippy --workspace -- -D warnings 8 | 9 | cargo nextest run --workspace -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 18.9.1 2 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "crates/ditto-cst", 4 | "crates/ditto-ast", 5 | "crates/ditto-checker", 6 | "crates/ditto-config", 7 | "crates/ditto-codegen-js", 8 | "crates/ditto-fmt", 9 | "crates/ditto-cli", 10 | "crates/ditto-lsp", 11 | "crates/ditto-tree-sitter", 12 | "crates/ditto-highlight", 13 | ] 14 | -------------------------------------------------------------------------------- /crates/ditto-ast/README.md: -------------------------------------------------------------------------------- 1 | # The ditto Abstract Syntax Tree (AST) 2 | 3 | The ditto AST is constructed by successfully type-checking the [CST](../ditto-cst). Every node contains complete typing information as well as other metadata useful for code generation and optimization. 4 | -------------------------------------------------------------------------------- /crates/ditto-ast/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![doc = include_str!("../README.md")] 2 | #![feature(box_patterns)] 3 | #![warn(missing_docs)] 4 | 5 | mod expression; 6 | pub mod graph; 7 | mod kind; 8 | mod module; 9 | mod name; 10 | mod r#type; 11 | mod var; 12 | 13 | pub use ditto_cst::Span; 14 | pub use expression::*; 15 | pub use kind::*; 16 | pub use module::*; 17 | pub use name::*; 18 | pub use r#type::*; 19 | pub use var::Var; 20 | -------------------------------------------------------------------------------- /crates/ditto-ast/src/var.rs: -------------------------------------------------------------------------------- 1 | /// We pepper a lot of variables around the syntax tree as part of type checking. 2 | /// This is the type of said variables. 3 | pub type Var = usize; 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/src/kindchecker/tests/mod.rs: -------------------------------------------------------------------------------- 1 | pub(self) mod macros; 2 | mod prim; 3 | mod variable; 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/src/kindchecker/tests/variable.rs: -------------------------------------------------------------------------------- 1 | use super::macros::*; 2 | use crate::TypeError::*; 3 | 4 | #[test] 5 | fn it_errors_as_expected() { 6 | assert_type_error!("a", UnknownTypeVariable { .. }); 7 | } 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![doc = include_str!("../README.md")] 2 | #![feature(box_patterns)] 3 | #![warn(missing_docs)] 4 | 5 | mod collections; 6 | mod kindchecker; 7 | mod module; 8 | mod result; 9 | mod supply; 10 | mod typechecker; 11 | 12 | pub use module::{check_module, Everything, Modules}; 13 | pub use result::{Result, TypeError, TypeErrorReport, Warning, WarningReport, Warnings}; 14 | -------------------------------------------------------------------------------- /crates/ditto-checker/src/module/type_declarations/tests/mod.rs: -------------------------------------------------------------------------------- 1 | mod acyclic; 2 | pub(self) mod macros; 3 | mod toposort; 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/src/module/value_declarations/tests/mod.rs: -------------------------------------------------------------------------------- 1 | mod acyclic; 2 | pub(self) mod macros; 3 | mod toposort; 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/src/result/mod.rs: -------------------------------------------------------------------------------- 1 | mod type_error; 2 | mod warnings; 3 | 4 | pub use type_error::{TypeError, TypeErrorReport}; 5 | pub use warnings::{Warning, WarningReport, Warnings}; 6 | 7 | /// Typechecking result. 8 | pub type Result = std::result::Result; 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/src/typechecker/tests/bool.rs: -------------------------------------------------------------------------------- 1 | use super::macros::*; 2 | 3 | #[test] 4 | fn it_typechecks_as_expected() { 5 | assert_type!("true", "Bool"); 6 | assert_type!("false", "Bool"); 7 | } 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/src/typechecker/tests/int.rs: -------------------------------------------------------------------------------- 1 | use super::macros::*; 2 | 3 | #[test] 4 | fn it_typechecks_as_expected() { 5 | assert_type!("5 ", "Int"); 6 | assert_type!("50505050505050", "Int"); 7 | assert_type!("(((5))) ", "Int"); 8 | assert_type!("5_50_500 ", "Int"); 9 | } 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/src/typechecker/tests/mod.rs: -------------------------------------------------------------------------------- 1 | mod array; 2 | mod bool; 3 | mod call; 4 | mod cond; 5 | mod effect; 6 | mod float; 7 | mod function; 8 | mod int; 9 | mod r#let; 10 | pub(self) mod macros; 11 | mod r#match; 12 | mod records; 13 | mod right_pipe; 14 | mod string; 15 | mod unit; 16 | -------------------------------------------------------------------------------- /crates/ditto-checker/src/typechecker/tests/string.rs: -------------------------------------------------------------------------------- 1 | use super::macros::*; 2 | 3 | #[test] 4 | fn it_typechecks_as_expected() { 5 | assert_type!(r#" "" "#, "String"); 6 | assert_type!(r#" "lorem ipsum" "#, "String"); 7 | assert_type!(r#" (("")) "#, "String"); 8 | } 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/src/typechecker/tests/unit.rs: -------------------------------------------------------------------------------- 1 | use super::macros::*; 2 | 3 | #[test] 4 | fn it_typechecks_as_expected() { 5 | assert_type!("unit", "Unit"); 6 | } 7 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/.ignore: -------------------------------------------------------------------------------- 1 | *.in -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/always_partial_application/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/always_partial_application/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/always_partial_application/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | always = fn (a) -> fn (_b) -> a 4 | five: Int = always(5)(true) 5 | 6 | always_five: (a) -> Int = always(5) 7 | another_five: Int = always_five(unit) 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/always_partial_application/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["always_partial_application.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/array_alias/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/array_alias/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/array_alias/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type alias Vec(a) = Array(a) 4 | 5 | fives : Vec(Int) = [5, 5, 5] 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/array_alias/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["array_alias.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/array_alias_chain/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/array_alias_chain/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/array_alias_chain/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type alias A(a) = Array(a) 4 | type alias B(a) = A(a) 5 | type alias Ints = B(Int) 6 | 7 | fives : Ints = [5, 5, 5] 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/array_alias_chain/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["array_alias_chain.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/array_int_alias_error/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[array_int_alias_error.ditto:4:1] 4 | 4 │ 5 | 5 │ oops : Ints = [true, false] 6 | · ──────┬────── 7 | · ╰── here 8 | ╰──── 9 | help: expected Ints 10 | got Array(Bool) 11 | 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/array_int_alias_error/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type alias Ints = Array(Int) 4 | 5 | oops : Ints = [true, false] 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/array_int_alias_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/array_int_alias_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/array_int_alias_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["array_int_alias_error.ditto"] 3 | status = "failed" 4 | fs.sandbox = true 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/basic_task_module/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/basic_task_module/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/basic_task_module/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["basic_task_module.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/closed_record_alias/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/closed_record_alias/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/closed_record_alias/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type alias Props = { a: Int, b: Bool, c: Unit } 4 | 5 | get_a = fn (props: Props) -> props.a 6 | 7 | five = get_a({ a = 5, b = true, c = unit }) 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/closed_record_alias/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["closed_record_alias.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_type_alias_error/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[cyclic_type_alias_error.ditto:4:1] 4 | 4 │ 5 | 5 │ wut : Foo = unit 6 | · ──┬─ 7 | · ╰── here 8 | ╰──── 9 | help: expected Foo 10 | got Unit 11 | 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_type_alias_error/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type alias Foo = Foo 4 | 5 | wut : Foo = unit 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_type_alias_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/cyclic_type_alias_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_type_alias_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["cyclic_type_alias_error.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_types/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/cyclic_types/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_types/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type A = A(B) 4 | 5 | type B = B(A) 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_types/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["cyclic_types.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_types_error/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × kinds don't unify 3 | ╭─[cyclic_types_error.ditto:2:1] 4 | 2 │ 5 | 3 │ type A = A(B) 6 | · ┬ 7 | · ╰── here 8 | 4 │ type B(c) = B(A, c) 9 | ╰──── 10 | help: expected Type 11 | got ($1) -> Type 12 | 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_types_error/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type A = A(B) 4 | type B(c) = B(A, c) 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_types_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/cyclic_types_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_types_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["cyclic_types_error.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_values/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/cyclic_values/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_values/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | a = b 4 | b = a 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_values/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["cyclic_values.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_values_error/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × expression isn't callable 3 | ╭─[cyclic_values_error.ditto:3:1] 4 | 3 │ a : Bool = b 5 | 4 │ b = a(true) 6 | · ┬ 7 | · ╰── can't call this 8 | ╰──── 9 | help: expression has type: Bool 10 | 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_values_error/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | a : Bool = b 4 | b = a(true) 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_values_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/cyclic_values_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/cyclic_values_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["cyclic_values_error.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/directly_unused_foreign_value/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused foreign value 3 | ╭─[directly_unused_foreign_value.ditto:2:1] 4 | 2 │ 5 | 3 │ foreign unused_impl: (Int) -> Bool 6 | · ─────────────────┬──────────────── 7 | · ╰── this isn't being used 8 | ╰──── 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/directly_unused_foreign_value/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | foreign unused_impl: (Int) -> Bool 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/directly_unused_foreign_value/test.stdout: -------------------------------------------------------------------------------- 1 | { 2 | "module_name": [ 3 | "Test" 4 | ], 5 | "exports": { 6 | "types": {}, 7 | "constructors": {}, 8 | "values": {} 9 | }, 10 | "types": {}, 11 | "constructors": {}, 12 | "values": {}, 13 | "values_toposort": [] 14 | } -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/directly_unused_foreign_value/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["directly_unused_foreign_value.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_alias/test.in/Bar.ditto: -------------------------------------------------------------------------------- 1 | module Bar exports (..) 2 | 3 | yes = true -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_alias/test.in/Foo.ditto: -------------------------------------------------------------------------------- 1 | module Foo exports (..) 2 | 3 | yes = true -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_alias/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × duplicate imports for module `X` 3 | ╭─[duplicate_import_alias.ditto:2:1] 4 | 2 │ 5 | 3 │ import Foo as X 6 | · ┬ 7 | · ╰── previous import 8 | 4 │ import Bar as X 9 | · ┬ 10 | · ╰── imported again here 11 | ╰──── 12 | help: try aliasing one of the imports? 13 | 14 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_alias/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Foo as X 4 | import Bar as X 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_alias/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/duplicate_import_alias/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_alias/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_import_alias.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_line/test.in/Dep.ditto: -------------------------------------------------------------------------------- 1 | module Dep exports (..) 2 | 3 | five = 5 -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_line/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × duplicate import 3 | ╭─[duplicate_import_line.ditto:2:1] 4 | 2 │ 5 | 3 │ import Dep 6 | · ─────┬──── 7 | · ╰── previous import 8 | 4 │ import Dep 9 | · ─────┬──── 10 | · ╰── duplicated here 11 | 5 │ 12 | ╰──── 13 | 14 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_line/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Dep 4 | import Dep 5 | 6 | dep_five = Dep.five 7 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_line/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/duplicate_import_line/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_line/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_import_line.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_module_name/test.in/bar/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (..) 2 | 3 | yes = true -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_module_name/test.in/foo/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (..) 2 | 3 | yes = true -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_module_name/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × duplicate imports for module `A` 3 | ╭─[duplicate_import_module_name.ditto:2:1] 4 | 2 │ 5 | 3 │ import (foo) A import (bar) A 6 | · ┬ ┬ 7 | · │ ╰── imported again here 8 | · ╰── previous import 9 | ╰──── 10 | help: try aliasing one of the imports? 11 | 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_module_name/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import (foo) A import (bar) A 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_module_name/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/duplicate_import_module_name/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_import_module_name/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_import_module_name.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_same_type_constructor/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × duplicate constructor 3 | ╭─[duplicate_same_type_constructor.ditto:3:1] 4 | 3 │ type A = 5 | 4 │ | A 6 | · ┬ 7 | · ╰── previously defined here 8 | 5 │ | A 9 | · ┬ 10 | · ╰── can't be redefined here 11 | ╰──── 12 | 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_same_type_constructor/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type A = 4 | | A 5 | | A 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_same_type_constructor/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/duplicate_same_type_constructor/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_same_type_constructor/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_same_type_constructor.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_constructor/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × duplicate constructor 3 | ╭─[duplicate_type_constructor.ditto:2:1] 4 | 2 │ 5 | 3 │ type A = A 6 | · ┬ 7 | · ╰── previously defined here 8 | 4 │ type B = A 9 | · ┬ 10 | · ╰── can't be redefined here 11 | ╰──── 12 | 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_constructor/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type A = A 4 | type B = A 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_constructor/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/duplicate_type_constructor/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_constructor/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_type_constructor.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_declaration/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × duplicate type declaration 3 | ╭─[duplicate_type_declaration.ditto:2:1] 4 | 2 │ 5 | 3 │ type A = A 6 | · ┬ 7 | · ╰── previously defined here 8 | 4 │ 9 | ╰──── 10 | ╭─[duplicate_type_declaration.ditto:7:1] 11 | 7 │ 12 | 8 │ type A = B | C 13 | · ┬ 14 | · ╰── can't be redefined here 15 | ╰──── 16 | 17 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_declaration/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type A = A 4 | 5 | 6 | 7 | 8 | type A = B | C 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_declaration/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/duplicate_type_declaration/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_declaration/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_type_declaration.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_export/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ duplicate type export 3 | ╭─[duplicate_type_export.ditto:1:1] 4 | 1 │ module Test exports ( 5 | 2 │ A, 6 | · ┬ 7 | · ╰── previously exported here 8 | 3 │ A, 9 | · ┬ 10 | · ╰── already exported 11 | 4 │ a, 12 | ╰──── 13 | 14 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_export/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports ( 2 | A, 3 | A, 4 | a, 5 | ) 6 | 7 | type A = A 8 | 9 | a = A 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_export/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_type_export.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_export_with_different_visibility/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ duplicate type export 3 | ╭─[duplicate_type_export_with_different_visibility.ditto:1:1] 4 | 1 │ module Test exports (A, A(..)) 5 | · ┬ ┬ 6 | · │ ╰── already exported 7 | · ╰── previously exported here 8 | 2 │ 9 | ╰──── 10 | 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_export_with_different_visibility/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (A, A(..)) 2 | 3 | type A = A 4 | 5 | -- NOTE: possibly deserves a different warning as the type visibility differs between the duplicates? 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_export_with_different_visibility/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_type_export_with_different_visibility.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_import/test.in/Maybe.ditto: -------------------------------------------------------------------------------- 1 | module Maybe exports ( 2 | Maybe(..), 3 | Private, 4 | mk_private, 5 | ) 6 | 7 | type Maybe(a) = Just(a) | Nothing 8 | 9 | type Private = Private 10 | 11 | mk_private = fn () -> Private 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_import/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ duplicate type import 3 | ╭─[duplicate_type_import.ditto:3:1] 4 | 3 │ import Maybe ( 5 | 4 │ Maybe, 6 | · ──┬── 7 | · ╰── previously imported here 8 | 5 │ Maybe 9 | · ──┬── 10 | · ╰── already imported 11 | 6 │ ) 12 | ╰──── 13 | 14 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_import/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Maybe ( 4 | Maybe, 5 | Maybe 6 | ) 7 | 8 | maybe_fives : Array(Maybe(Int)) = [] 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_import/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_type_import.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_import_with_different_visibility/test.in/Maybe.ditto: -------------------------------------------------------------------------------- 1 | module Maybe exports ( 2 | Maybe(..), 3 | Private, 4 | mk_private, 5 | ) 6 | 7 | type Maybe(a) = Just(a) | Nothing 8 | 9 | type Private = Private 10 | 11 | mk_private = fn () -> Private 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_import_with_different_visibility/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ duplicate type import 3 | ╭─[duplicate_type_import_with_different_visibility.ditto:3:1] 4 | 3 │ import Maybe ( 5 | 4 │ Maybe, 6 | · ──┬── 7 | · ╰── previously imported here 8 | 5 │ Maybe(..), 9 | · ──┬── 10 | · ╰── already imported 11 | 6 │ ) 12 | ╰──── 13 | 14 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_import_with_different_visibility/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Maybe ( 4 | Maybe, 5 | Maybe(..), 6 | ) 7 | 8 | maybe_fives : Array(Maybe(Bool)) = [Just(true)] 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_type_import_with_different_visibility/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_type_import_with_different_visibility.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_value_declaration/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × duplicate top-level name 3 | ╭─[duplicate_value_declaration.ditto:1:1] 4 | 1 │ module Test exports (..) a : Bool = true a : Int = 5 5 | · ┬ ┬ 6 | · │ ╰── can't be redefined here 7 | · ╰── previously defined here 8 | ╰──── 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_value_declaration/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) a : Bool = true a : Int = 5 2 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_value_declaration/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/duplicate_value_declaration/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_value_declaration/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_value_declaration.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_value_export/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ duplicate value export 3 | ╭─[duplicate_value_export.ditto:1:1] 4 | 1 │ module Test exports (five, five) 5 | · ──┬─ ──┬─ 6 | · │ ╰── already exported 7 | · ╰── previously exported here 8 | 2 │ 9 | ╰──── 10 | 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_value_export/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (five, five) 2 | 3 | five = 5 -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_value_export/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_value_export.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_value_import/test.in/Foo.ditto: -------------------------------------------------------------------------------- 1 | module Foo exports ( 2 | five, 3 | identity, 4 | ) 5 | 6 | identity = fn (a) -> a 7 | 8 | five = 5 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_value_import/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ duplicate value import 3 | ╭─[duplicate_value_import.ditto:2:1] 4 | 2 │ 5 | 3 │ import Foo (five, five) 6 | · ──┬─ ──┬─ 7 | · │ ╰── already imported 8 | · ╰── previously imported here 9 | 4 │ 10 | ╰──── 11 | 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_value_import/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Foo (five, five) 4 | 5 | fives = [five, five, five] 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/duplicate_value_import/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["duplicate_value_import.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/export_docs/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/export_docs/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/export_docs/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports ( 2 | anything_to_a, 3 | A(..), 4 | ) 5 | 6 | -- Documentation for 7 | -- my type `A` 8 | type A = 9 | -- Documentation for the only constructor 10 | -- of type `A` 11 | MkA 12 | 13 | -- This function takes anything and returns an `A`. 14 | anything_to_a = fn (_): A -> MkA 15 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/export_docs/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["export_docs.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/float_alias/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/float_alias/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/float_alias/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (high_five) 2 | 3 | type alias Number = Float 4 | 5 | number_five: Number = 5.0 6 | 7 | floaty_five : Float = number_five 8 | 9 | gimme_five = fn (five: Number): Float -> five 10 | 11 | high_five = gimme_five(floaty_five) 12 | 13 | -- TODO: if the type alias isn't exported then references to it should 14 | -- be erased from the exports. 15 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/float_alias/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["float_alias.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/float_alias_chain/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/float_alias_chain/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/float_alias_chain/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type alias A = Float 4 | type alias B = A 5 | type alias C = B 6 | 7 | five : C = 5.0 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/float_alias_chain/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["float_alias_chain.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/foreign_function_impl/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/foreign_function_impl/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/foreign_function_impl/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) -- `..` shouldn't expose example_impl ! 2 | 3 | -- implemented elsewhere 4 | example = example_impl 5 | 6 | foreign example_impl : (Int, Float) -> Unit 7 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/foreign_function_impl/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["foreign_function_impl.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/foreign_value_impl/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/foreign_value_impl/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/foreign_value_impl/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (probably_five) 2 | 3 | foreign ffi_int: Int 4 | 5 | id_int = fn (n: Int) -> n 6 | 7 | probably_five = id_int(ffi_int) 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/foreign_value_impl/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["foreign_value_impl.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/function_type_alias/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/function_type_alias/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/function_type_alias/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (five) 2 | 3 | type alias Identity(a) = (a) -> a 4 | 5 | five = identity_impl(5) 6 | 7 | foreign identity_impl: Identity(a) 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/function_type_alias/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["function_type_alias.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/homogeneous_type_alias_array/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/homogeneous_type_alias_array/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/homogeneous_type_alias_array/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type alias Foo = Bool 4 | type alias Bar = Bool 5 | type alias Baz = Bool 6 | 7 | foo : Foo = true 8 | bar : Bar = false 9 | baz : Baz = true 10 | 11 | bools : Array(Bool) = [foo, bar, baz] 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/homogeneous_type_alias_array/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["homogeneous_type_alias_array.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/imported_bool_alias/test.in/Boolean.ditto: -------------------------------------------------------------------------------- 1 | module Boolean exports (example, Boolean) 2 | 3 | -- It's like `Bool` but longer... 4 | type alias Boolean = Bool 5 | 6 | example : Boolean = false -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/imported_bool_alias/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/imported_bool_alias/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/imported_bool_alias/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Boolean (Boolean) 4 | 5 | my_boolean : Boolean = true 6 | 7 | five = if Boolean.example then 5 else 5 -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/imported_bool_alias/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["imported_bool_alias.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/imported_constructor_matching/test.in/Dep.ditto: -------------------------------------------------------------------------------- 1 | module Dep exports (..) 2 | 3 | type ABC(c) = A | B(Int) | C(Bool, c) 4 | 5 | n_params = fn (abc): Int -> 6 | match abc with 7 | | A -> 0 8 | | B(_) -> 1 9 | | C(_, _) -> 2 10 | end 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/imported_constructor_matching/test.in/Maybe.ditto: -------------------------------------------------------------------------------- 1 | module Maybe exports (..) 2 | 3 | type Maybe(a) = Just(a) | Nothing -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/imported_constructor_matching/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/imported_constructor_matching/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/imported_constructor_matching/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Dep 4 | import Maybe 5 | 6 | 7 | zero = Dep.n_params(Dep.A) 8 | 9 | abc_to_bool = fn (abc) -> 10 | match abc with 11 | | Dep.C(bool, _) -> Maybe.Just(bool) 12 | | _ -> Maybe.Nothing 13 | end -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/imported_constructor_matching/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["imported_constructor_matching.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/indirectly_unused_foreign_value/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused top-level value 3 | ╭─[indirectly_unused_foreign_value.ditto:4:1] 4 | 4 │ 5 | 5 │ unused = unused_impl 6 | · ───┬── 7 | · ╰── this isn't referenced or exported 8 | 6 │ 9 | ╰──── 10 | 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/indirectly_unused_foreign_value/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (five) 2 | 3 | five : Float = 5.0 4 | 5 | unused = unused_impl 6 | 7 | foreign unused_impl: (Int) -> Bool 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/indirectly_unused_foreign_value/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["indirectly_unused_foreign_value.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_destructure_not_exhaustive_error/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × match not exhaustive 3 | ╭─[let_destructure_not_exhaustive_error.ditto:8:1] 4 | 8 │ let 5 | 9 │ Some(five) = option_five 6 | · ─────┬──── 7 | · ╰── this match expression 8 | 10 │ in 9 | ╰──── 10 | help: patterns not covered: 11 | None 12 | 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_destructure_not_exhaustive_error/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Option(a) = None | Some(a) 4 | 5 | option_five = Some(5) 6 | 7 | bang = 8 | let 9 | Some(five) = option_five 10 | in 11 | unit 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_destructure_not_exhaustive_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/let_destructure_not_exhaustive_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_destructure_not_exhaustive_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["let_destructure_not_exhaustive_error.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_destructuring/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/let_destructuring/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_destructuring/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Wrapper(a) = Wrapped(a) 4 | 5 | wrapped_five = Wrapped(5) 6 | 7 | fives = let Wrapped(five) = wrapped_five in [five, five] 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_destructuring/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["let_destructuring.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_not_in_scope_error/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × unknown variable 3 | ╭─[let_not_in_scope_error.ditto:4:1] 4 | 4 │ let 5 | 5 │ fives = [five] 6 | · ──┬─ 7 | · ╰── not in scope 8 | 6 │ five: Int = 5 9 | ╰──── 10 | 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_not_in_scope_error/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | bang = 4 | let 5 | fives = [five] 6 | five: Int = 5 7 | in 8 | fives 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_not_in_scope_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/let_not_in_scope_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_not_in_scope_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["let_not_in_scope_error.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_recursive_error/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × unknown variable 3 | ╭─[let_recursive_error.ditto:4:1] 4 | 4 │ let 5 | 5 │ a = b 6 | · ┬ 7 | · ╰── not in scope 8 | 6 │ b = a 9 | ╰──── 10 | 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_recursive_error/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | bang = 4 | let 5 | a = b 6 | b = a 7 | in 8 | unit 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_recursive_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/let_recursive_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_recursive_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["let_recursive_error.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_unused_warning/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused let binder 3 | ╭─[let_unused_warning.ditto:2:1] 4 | 2 │ 5 | 3 │ why = let fives : Array(Int) = [5] in unit 6 | · ──┬── 7 | · ╰── this isn't used 8 | ╰──── 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_unused_warning/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | why = let fives : Array(Int) = [5] in unit 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/let_unused_warning/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["let_unused_warning.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/maybe_int_alias/test.in/Maybe.ditto: -------------------------------------------------------------------------------- 1 | module Maybe exports (..) 2 | 3 | type Maybe(a) = Just(a) | Nothing -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/maybe_int_alias/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/maybe_int_alias/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/maybe_int_alias/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Maybe 4 | 5 | type alias Maybe = Maybe.Maybe(Int) 6 | 7 | just_int = fn (i: Int): Maybe -> Maybe.Just(i) 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/maybe_int_alias/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["maybe_int_alias.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/mini_vdom/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/mini_vdom/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/mini_vdom/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Html(msg) 4 | 5 | type Attr = Attr(String, String) 6 | 7 | div = fn ( 8 | attrs: Array(Attr), 9 | children: Array(Html(msg)), 10 | ): Html(msg) -> h("div", attrs, children) 11 | 12 | foreign h : (String, Array(Attr), Array(Html(msg))) -> Html(msg) 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/mini_vdom/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["mini_vdom.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/module_not_found/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × module not found 3 | ╭─[module_not_found.ditto:2:1] 4 | 2 │ 5 | 3 │ import Huh (nah) 6 | · ─┬─ 7 | · ╰── not found 8 | 4 │ 9 | ╰──── 10 | 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/module_not_found/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Huh (nah) 4 | 5 | five : Float = 5.0 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/module_not_found/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/module_not_found/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/module_not_found/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["module_not_found.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/never/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/never/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/never/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (Never, never) 2 | 3 | type Never = JustOneMore(Never) 4 | 5 | never = fn (nah: Never): a -> 6 | match nah with 7 | | JustOneMore(naah) -> never(naah) 8 | end 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/never/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["never.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/open_record_alias/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/open_record_alias/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/open_record_alias/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type alias HasFoo(r, a) = { r | foo: a } 4 | 5 | foo : HasFoo({ bar: Bool }, Int) = { foo = 5, bar = true } 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/open_record_alias/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["open_record_alias.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/open_record_alias_chain/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/open_record_alias_chain/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/open_record_alias_chain/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["open_record_alias_chain.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/open_record_alias_chain_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/open_record_alias_chain_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/open_record_alias_chain_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["open_record_alias_chain_error.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/open_record_alias_error/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type alias HasFoo(r, a) = { r | foo: a } 4 | 5 | foo : HasFoo({ bar: Bool }, Int) = { foo = 5, bar = "nah" } 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/open_record_alias_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/open_record_alias_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/open_record_alias_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["open_record_alias_error.ditto"] 3 | status = "failed" 4 | fs.sandbox = true 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/option_alias/test.in/base/Maybe.ditto: -------------------------------------------------------------------------------- 1 | module Maybe exports (..) 2 | 3 | type Maybe(a) = Just(a) | Nothing -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/option_alias/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/option_alias/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/option_alias/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import (base) Maybe (Maybe) 4 | 5 | type alias Option(a) = Maybe(a) 6 | 7 | some = fn (a: a): Option(a) -> Maybe.Just(a) 8 | none = fn (): Option(a) -> Maybe.Nothing 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/option_alias/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["option_alias.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/package_not_found/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × package not found 3 | ╭─[package_not_found.ditto:2:1] 4 | 2 │ 5 | 3 │ import (wut) Huh (nah) 6 | · ─┬─ 7 | · ╰── not installed 8 | 4 │ 9 | ╰──── 10 | help: try adding `wut` to your dependencies? 11 | 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/package_not_found/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import (wut) Huh (nah) 4 | 5 | 6 | five : Float = 5.0 7 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/package_not_found/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/package_not_found/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/package_not_found/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["package_not_found.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/private_type_constructors_import/test.in/Dep.ditto: -------------------------------------------------------------------------------- 1 | module Dep exports (Abstract, abstract_value) 2 | 3 | type Abstract = Abstract(Int, Bool, Unit) 4 | 5 | abstract_value = Abstract(5, true, unit) 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/private_type_constructors_import/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × no visible constructors 3 | ╭─[private_type_constructors_import.ditto:2:1] 4 | 2 │ 5 | 3 │ import Dep (Abstract(..)) 6 | · ──┬─ 7 | · ╰── `Abstract` type is private 8 | ╰──── 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/private_type_constructors_import/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Dep (Abstract(..)) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/private_type_constructors_import/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/private_type_constructors_import/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/private_type_constructors_import/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["private_type_constructors_import.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_constructors/test.in/Bar.ditto: -------------------------------------------------------------------------------- 1 | module Bar exports (..) 2 | 3 | type Bar = A -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_constructors/test.in/Foo.ditto: -------------------------------------------------------------------------------- 1 | module Foo exports (..) 2 | 3 | type Foo = A -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_constructors/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × constructor `A` imported multiple times 3 | ╭─[rebound_import_constructors.ditto:2:1] 4 | 2 │ 5 | 3 │ import Foo (Foo(..)) 6 | · ──┬─ 7 | · ╰── first imported here 8 | 4 │ import Bar (Bar(..)) 9 | · ──┬─ 10 | · ╰── imported again here 11 | ╰──── 12 | 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_constructors/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Foo (Foo(..)) 4 | import Bar (Bar(..)) 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_constructors/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/rebound_import_constructors/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_constructors/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["rebound_import_constructors.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_type/test.in/Bar.ditto: -------------------------------------------------------------------------------- 1 | module Bar exports (..) 2 | 3 | type A = A -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_type/test.in/Foo.ditto: -------------------------------------------------------------------------------- 1 | module Foo exports (..) 2 | 3 | type A(a) = A -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_type/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × type `A` imported multiple times 3 | ╭─[rebound_import_type.ditto:2:1] 4 | 2 │ 5 | 3 │ import Foo (A) 6 | · ┬ 7 | · ╰── first imported here 8 | 4 │ import Bar (A) 9 | · ┬ 10 | · ╰── imported again here 11 | ╰──── 12 | 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_type/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Foo (A) 4 | import Bar (A) 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_type/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/rebound_import_type/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_type/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["rebound_import_type.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_value/test.in/Bar.ditto: -------------------------------------------------------------------------------- 1 | module Bar exports (..) 2 | 3 | yes = true -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_value/test.in/Foo.ditto: -------------------------------------------------------------------------------- 1 | module Foo exports (..) 2 | 3 | yes = true -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_value/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × value `yes` imported multiple times 3 | ╭─[rebound_import_value.ditto:2:1] 4 | 2 │ 5 | 3 │ import Foo (yes) 6 | · ─┬─ 7 | · ╰── first imported here 8 | 4 │ import Bar (yes) 9 | · ─┬─ 10 | · ╰── imported again here 11 | ╰──── 12 | 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_value/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Foo (yes) 4 | import Bar (yes) 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_value/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/rebound_import_value/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/rebound_import_value/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["rebound_import_value.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/record_extension_newtype/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/record_extension_newtype/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/record_extension_newtype/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["record_extension_newtype.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/refutable_function_binder/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × refutable function binder 3 | ╭─[refutable_function_binder.ditto:6:1] 4 | 6 │ 5 | 7 │ from_just = fn (Just(a)) -> a 6 | · ───┬─── 7 | · ╰── this pattern 8 | ╰──── 9 | help: patterns here must cover all cases 10 | 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/refutable_function_binder/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Maybe(a) = 4 | | Just(a) 5 | | Nothing 6 | 7 | from_just = fn (Just(a)) -> a 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/refutable_function_binder/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/refutable_function_binder/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/refutable_function_binder/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["refutable_function_binder.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/result_alias_effect_matching/test.in/Result.ditto: -------------------------------------------------------------------------------- 1 | module Result exports (Result(..)) 2 | 3 | type Result(a, e) = Ok(a) | Err(e) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/result_alias_effect_matching/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/result_alias_effect_matching/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/result_alias_effect_matching/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Result 4 | 5 | type alias Result = Result.Result(Int, String) 6 | 7 | match_my_result = fn (eff: Effect(Result)): Effect(Bool) -> do { 8 | res <- eff; 9 | return match res with 10 | | Result.Ok(_) -> true 11 | | Result.Err(_) -> false 12 | end 13 | } 14 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/result_alias_effect_matching/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["result_alias_effect_matching.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/result_alias_matching/test.in/Result.ditto: -------------------------------------------------------------------------------- 1 | module Result exports (Result(..)) 2 | 3 | type Result(a, e) = Ok(a) | Err(e) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/result_alias_matching/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/result_alias_matching/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/result_alias_matching/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Result 4 | 5 | type alias Result = Result.Result(Int, String) 6 | 7 | match_my_result = fn (res: Result): Bool -> 8 | match res with 9 | | Result.Ok(_) -> true 10 | | Result.Err(_) -> false 11 | end 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/result_alias_matching/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["result_alias_matching.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/self_referencing_function_error/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × wrong number of arguments 3 | ╭─[self_referencing_function_error.ditto:2:1] 4 | 2 │ 5 | 3 │ spin = fn () -> spin(2) 6 | · ──┬─ 7 | · ╰── this expects no arguments 8 | ╰──── 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/self_referencing_function_error/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | spin = fn () -> spin(2) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/self_referencing_function_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/self_referencing_function_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/self_referencing_function_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["self_referencing_function_error.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/simple_type_imports/test.in/Maybe.ditto: -------------------------------------------------------------------------------- 1 | module Maybe exports ( 2 | Maybe(..), 3 | Private, 4 | mk_private, 5 | ) 6 | 7 | type Maybe(a) = Just(a) | Nothing 8 | 9 | type Private = Private 10 | 11 | mk_private = fn () -> Private 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/simple_type_imports/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/simple_type_imports/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/simple_type_imports/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Maybe as M ( 4 | Maybe(..) 5 | ) 6 | 7 | maybe_fives : Array(M.Maybe(Int)) = [ 8 | M.Just(5), 9 | Just(5), 10 | ] 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/simple_type_imports/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["simple_type_imports.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/simple_value_imports/test.in/Foo.ditto: -------------------------------------------------------------------------------- 1 | module Foo exports ( 2 | five, 3 | identity, 4 | ) 5 | 6 | identity = fn (a) -> a 7 | 8 | five = 5 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/simple_value_imports/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/simple_value_imports/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/simple_value_imports/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Foo as F (five) 4 | 5 | another_five : Int = F.identity(five) 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/simple_value_imports/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["simple_value_imports.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_type_export/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × unknown type export 3 | ╭─[unknown_type_export.ditto:1:1] 4 | 1 │ module Test exports (Huh) 5 | · ─┬─ 6 | · ╰── this type isn't defined? 7 | ╰──── 8 | 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_type_export/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (Huh) 2 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_type_export/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/unknown_type_export/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_type_export/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["unknown_type_export.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_type_import/test.in/Dep.ditto: -------------------------------------------------------------------------------- 1 | module Dep exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_type_import/test.out/Dep.ast: -------------------------------------------------------------------------------- 1 | { 2 | "module_name": [ 3 | "Dep" 4 | ], 5 | "exports": { 6 | "types": {}, 7 | "constructors": {}, 8 | "values": {} 9 | }, 10 | "types": {}, 11 | "constructors": {}, 12 | "values": {}, 13 | "values_toposort": [] 14 | } -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_type_import/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × unknown type import 3 | ╭─[unknown_type_import.ditto:2:1] 4 | 2 │ 5 | 3 │ import Dep (Huh) 6 | · ─┬─ 7 | · ╰── this type isn't exposed? 8 | ╰──── 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_type_import/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Dep (Huh) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_type_import/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/unknown_type_import/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_type_import/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["unknown_type_import.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_value_export/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × unknown value export 3 | ╭─[unknown_value_export.ditto:1:1] 4 | 1 │ module Test exports (wut) 5 | · ─┬─ 6 | · ╰── this value isn't defined? 7 | ╰──── 8 | 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_value_export/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (wut) 2 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_value_export/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/unknown_value_export/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_value_export/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["unknown_value_export.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_value_import/test.in/Dep.ditto: -------------------------------------------------------------------------------- 1 | module Dep exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_value_import/test.out/Dep.ast: -------------------------------------------------------------------------------- 1 | { 2 | "module_name": [ 3 | "Dep" 4 | ], 5 | "exports": { 6 | "types": {}, 7 | "constructors": {}, 8 | "values": {} 9 | }, 10 | "types": {}, 11 | "constructors": {}, 12 | "values": {}, 13 | "values_toposort": [] 14 | } -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_value_import/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × unknown value import 3 | ╭─[unknown_value_import.ditto:2:1] 4 | 2 │ 5 | 3 │ import Dep (nah) 6 | · ─┬─ 7 | · ╰── this value isn't exposed? 8 | ╰──── 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_value_import/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Dep (nah) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_value_import/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/unknown_value_import/test.stdout -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unknown_value_import/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["unknown_value_import.ditto"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_import_line/test.in/Dep.ditto: -------------------------------------------------------------------------------- 1 | module Dep exports (..) 2 | 3 | type ABC = A | B | C 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_import_line/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused import 3 | ╭─[unused_import_line.ditto:2:1] 4 | 2 │ 5 | 3 │ import Dep 6 | · ─────┬──── 7 | · ╰── not needed 8 | 4 │ 9 | ╰──── 10 | 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_import_line/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Dep 4 | 5 | five = 5 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_import_line/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["unused_import_line.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_package_import_line/test.in/pkg/Dep.ditto: -------------------------------------------------------------------------------- 1 | module Dep exports (..) 2 | 3 | type ABC = A | B | C 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_package_import_line/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused import 3 | ╭─[unused_package_import_line.ditto:2:1] 4 | 2 │ 5 | 3 │ import (pkg) Dep 6 | · ────────┬─────── 7 | · ╰── not needed 8 | 4 │ 9 | ╰──── 10 | 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_package_import_line/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import (pkg) Dep 4 | 5 | five = 5 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_package_import_line/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["unused_package_import_line.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_type_constructors/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused type constructors 3 | ╭─[unused_type_constructors.ditto:2:1] 4 | 2 │ 5 | 3 │ type A = A 6 | · ┬ 7 | · ╰── type is never constructed 8 | ╰──── 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_type_constructors/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (A) 2 | 3 | type A = A 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_type_constructors/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["unused_type_constructors.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_type_declaration/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused type declaration 3 | ╭─[unused_type_declaration.ditto:3:1] 4 | 3 │ type A = A 5 | 4 │ type B = B 6 | · ┬ 7 | · ╰── this isn't referenced or exported 8 | ╰──── 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_type_declaration/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (A(..)) 2 | 3 | type A = A 4 | type B = B 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_type_declaration/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["unused_type_declaration.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_unqualified_type_import/test.in/Five.ditto: -------------------------------------------------------------------------------- 1 | module Five exports (..) 2 | 3 | type Five = Five 4 | 5 | five = 5 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_unqualified_type_import/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/unused_unqualified_type_import/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_unqualified_type_import/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Five (Five) 4 | 5 | five = Five.five 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_unqualified_type_import/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["unused_unqualified_type_import.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_unqualified_value_import/test.in/Five.ditto: -------------------------------------------------------------------------------- 1 | module Five exports (..) 2 | 3 | type Five = Five 4 | 5 | five = 5 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_unqualified_value_import/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/unused_unqualified_value_import/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_unqualified_value_import/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Five (five) 4 | 5 | five = Five.Five 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_unqualified_value_import/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["unused_unqualified_value_import.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_value_declaration/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused top-level value 3 | ╭─[unused_value_declaration.ditto:3:1] 4 | 3 │ a : Bool = true 5 | 4 │ b : Int = 5 6 | · ┬ 7 | · ╰── this isn't referenced or exported 8 | 5 │ 9 | ╰──── 10 | 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_value_declaration/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (a, c) 2 | 3 | a : Bool = true 4 | b : Int = 5 5 | 6 | 7 | c = fn (b) -> b -- not referencing `b` above, that is still unused 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/unused_value_declaration/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["unused_value_declaration.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/variable_alias/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-checker/tests/cmd/variable_alias/test.stderr -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/variable_alias/test.stdin: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type alias WhyTho(a) = a 4 | 5 | identity = fn (a: WhyTho(a)) -> a 6 | 7 | five : Float = identity(5.0) 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/cmd/variable_alias/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-checker-testbin-check-module" 2 | args = ["variable_alias.ditto"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/argument_length_mismatch_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | my_fn = fn (n : Int) -> n 4 | 5 | five = my_fn() 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/argument_length_mismatch_0.error: -------------------------------------------------------------------------------- 1 | 2 | × wrong number of arguments 3 | ╭─[golden:2:1] 4 | 2 │ 5 | 3 │ my_fn = fn (n : Int) -> n 6 | 4 │ 7 | 5 │ five = my_fn() 8 | · ──┬── 9 | · ╰── this expects 1 argument 10 | ╰──── 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/argument_length_mismatch_1.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | my_fn = fn () -> 5 4 | 5 | five = my_fn(5) 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/argument_length_mismatch_1.error: -------------------------------------------------------------------------------- 1 | 2 | × wrong number of arguments 3 | ╭─[golden:2:1] 4 | 2 │ 5 | 3 │ my_fn = fn () -> 5 6 | 4 │ 7 | 5 │ five = my_fn(5) 8 | · ──┬── 9 | · ╰── this expects no arguments 10 | ╰──── 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/argument_length_mismatch_2.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | my_fn = fn (x: Int, y: Int, z: Int) -> 5 4 | 5 | five = my_fn(10) 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/argument_length_mismatch_2.error: -------------------------------------------------------------------------------- 1 | 2 | × wrong number of arguments 3 | ╭─[golden:2:1] 4 | 2 │ 5 | 3 │ my_fn = fn (x: Int, y: Int, z: Int) -> 5 6 | 4 │ 7 | 5 │ five = my_fn(10) 8 | · ──┬── 9 | · ╰── this expects 3 arguments 10 | ╰──── 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/argument_length_mismatch_3.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | bad_pipe = 5 |> (fn () -> 10) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/argument_length_mismatch_3.error: -------------------------------------------------------------------------------- 1 | 2 | × wrong number of arguments 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ bad_pipe = 5 |> (fn () -> 10) 7 | · ─────┬───── 8 | · ╰── this expects no arguments 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_function_binder.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | too_many_ys = fn (x, y, y, z) -> z 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_function_binder.error: -------------------------------------------------------------------------------- 1 | 2 | × duplicate function parameter 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ too_many_ys = fn (x, y, y, z) -> z 7 | · ┬ ┬ 8 | · │ ╰── name can't be reused here 9 | · ╰── previous parameter 10 | ╰──── 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_import_line.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Data.Stuff (id) 4 | import Data.Stuff 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_import_line.error: -------------------------------------------------------------------------------- 1 | 2 | × duplicate import 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ import Data.Stuff (id) 7 | · ────────┬──────── 8 | · ╰── previous import 9 | 4 │ import Data.Stuff 10 | · ────────┬──────── 11 | · ╰── duplicated here 12 | ╰──── 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_import_module_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import (test-stuff) Data.Stuff 4 | import Data.Stuff 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_import_module_1.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import (test-stuff) Data.Stuff as Stf 4 | import Data.Stuff as Stf 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_pattern_binder.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Pair(a, b) = Pair(a, b) 4 | 5 | nope = fn (pair: Pair(a, a)): Array(a) -> 6 | match pair with 7 | | Pair(a, a) -> [a, a] 8 | end 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_pattern_binder.error: -------------------------------------------------------------------------------- 1 | 2 | × duplicate pattern variable 3 | ╭─[golden:4:1] 4 | 4 │ 5 | 5 │ nope = fn (pair: Pair(a, a)): Array(a) -> 6 | 6 │ match pair with 7 | 7 │ | Pair(a, a) -> [a, a] 8 | · ┬ ┬ 9 | · │ ╰── name can't be reused here 10 | · ╰── previous variable 11 | 8 │ end 12 | ╰──── 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_type_declaration.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type SomeType = A 4 | 5 | 6 | type SomeType = B 7 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_type_declaration.error: -------------------------------------------------------------------------------- 1 | 2 | × duplicate type declaration 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ type SomeType = A 7 | · ────┬─── 8 | · ╰── previously defined here 9 | 4 │ 10 | 5 │ 11 | 6 │ type SomeType = B 12 | · ────┬─── 13 | · ╰── can't be redefined here 14 | ╰──── 15 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_type_declaration_constructor.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type SomeType = A 4 | type SomeOtherType = A | B 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_type_declaration_constructor.error: -------------------------------------------------------------------------------- 1 | 2 | × duplicate constructor 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ type SomeType = A 7 | · ┬ 8 | · ╰── previously defined here 9 | 4 │ type SomeOtherType = A | B 10 | · ┬ 11 | · ╰── can't be redefined here 12 | ╰──── 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_type_declaration_variable.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | 4 | 5 | type Foo(a, a) = Foo(a) 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_type_declaration_variable.error: -------------------------------------------------------------------------------- 1 | 2 | × duplicate type variable 3 | ╭─[golden:2:1] 4 | 2 │ 5 | 3 │ 6 | 4 │ 7 | 5 │ type Foo(a, a) = Foo(a) 8 | · ┬ ┬ 9 | · │ ╰── can't be reintroduced here 10 | · ╰── previously introduced here 11 | ╰──── 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_value_declaration.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | five = 5 4 | 5 | 6 | five = 5 7 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/duplicate_value_declaration.error: -------------------------------------------------------------------------------- 1 | 2 | × duplicate top-level name 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ five = 5 7 | · ──┬─ 8 | · ╰── previously defined here 9 | 4 │ 10 | 5 │ 11 | 6 │ five = 5 12 | · ──┬─ 13 | · ╰── can't be redefined here 14 | ╰──── 15 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/effect_unification_error_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | not_an_effect = do { 4 | huh <- 5; 5 | return unit 6 | } 7 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/effect_unification_error_0.error: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ not_an_effect = do { 7 | 4 │ huh <- 5; 8 | · ┬ 9 | · ╰── here 10 | 5 │ return unit 11 | 6 │ } 12 | ╰──── 13 | help: expected Effect($1) 14 | got Int 15 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/infinite_type.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | boom = fn (f) -> f(f) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/infinite_type.error: -------------------------------------------------------------------------------- 1 | 2 | × infinite type 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ boom = fn (f) -> f(f) 7 | · ┬ 8 | · ╰── here 9 | ╰──── 10 | help: try adding type annotations? 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/kind_unification_error_1.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | fives : Array = [1, 2, 3] 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/kind_unification_error_1.error: -------------------------------------------------------------------------------- 1 | 2 | × kinds don't unify 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ fives : Array = [1, 2, 3] 7 | · ──┬── 8 | · ╰── here 9 | ╰──── 10 | help: expected Type 11 | got (Type) -> Type 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_not_exhaustive_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Maybe(a) = Just(a) | Nothing 4 | 5 | unwrap = fn (maybe: Maybe(Int)): Int -> 6 | match maybe with 7 | | Just(n) -> n 8 | end 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_not_exhaustive_0.error: -------------------------------------------------------------------------------- 1 | 2 | × match not exhaustive 3 | ╭─[golden:3:1] 4 | 3 │ type Maybe(a) = Just(a) | Nothing 5 | 4 │ 6 | 5 │ unwrap = fn (maybe: Maybe(Int)): Int -> 7 | 6 │ ╭─▶ match maybe with 8 | 7 │ │ | Just(n) -> n 9 | 8 │ ├─▶ end 10 | · ╰──── this match expression 11 | ╰──── 12 | help: patterns not covered: 13 | Nothing 14 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_not_exhaustive_1.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type ABC = A | B | C 4 | 5 | y_tho = fn (abc: ABC) -> 6 | match abc with 7 | | A -> 0 8 | end 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_not_exhaustive_1.error: -------------------------------------------------------------------------------- 1 | 2 | × match not exhaustive 3 | ╭─[golden:3:1] 4 | 3 │ type ABC = A | B | C 5 | 4 │ 6 | 5 │ y_tho = fn (abc: ABC) -> 7 | 6 │ ╭─▶ match abc with 8 | 7 │ │ | A -> 0 9 | 8 │ ├─▶ end 10 | · ╰──── this match expression 11 | ╰──── 12 | help: patterns not covered: 13 | B 14 | C 15 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Foo = Foo 4 | type Bar = Bar 5 | 6 | nah = 7 | match Foo with 8 | | Bar -> unit 9 | end 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_0.error: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[golden:5:1] 4 | 5 │ 5 | 6 │ nah = 6 | 7 │ match Foo with 7 | 8 │ | Bar -> unit 8 | · ─┬─ 9 | · ╰── here 10 | 9 │ end 11 | ╰──── 12 | help: expected Foo 13 | got Bar 14 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_1.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Maybe(a) = Just(a) | Nothing 4 | type Foo = Foo 5 | type Bar = Bar 6 | 7 | nah = fn (maybe_foo : Maybe(Foo)) -> 8 | match maybe_foo with 9 | | Just(Bar) -> unit 10 | | Nothing -> unit 11 | end 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_1.error: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[golden:6:1] 4 | 6 │ 5 | 7 │ nah = fn (maybe_foo : Maybe(Foo)) -> 6 | 8 │ match maybe_foo with 7 | 9 │ | Just(Bar) -> unit 8 | · ─┬─ 9 | · ╰── here 10 | 10 │ | Nothing -> unit 11 | 11 │ end 12 | ╰──── 13 | help: expected Foo 14 | got Bar 15 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_2.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Maybe(a) = Just(a) | Nothing 4 | 5 | nah = fn (maybe_foo : Maybe(Int)) -> 6 | match maybe_foo with 7 | | Just(a, b) -> unit 8 | | Nothing -> unit 9 | end 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_2.error: -------------------------------------------------------------------------------- 1 | 2 | × wrong number of arguments 3 | ╭─[golden:4:1] 4 | 4 │ 5 | 5 │ nah = fn (maybe_foo : Maybe(Int)) -> 6 | 6 │ match maybe_foo with 7 | 7 │ | Just(a, b) -> unit 8 | · ─────┬──── 9 | · ╰── this expects 1 argument 10 | 8 │ | Nothing -> unit 11 | 9 │ end 12 | ╰──── 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_3.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Maybe(a) = Just(a) | Nothing 4 | 5 | nah = fn (maybe_foo : Maybe(Int)) -> 6 | match maybe_foo with 7 | | Just -> unit 8 | | Nothing -> unit 9 | end 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_3.error: -------------------------------------------------------------------------------- 1 | 2 | × wrong number of arguments 3 | ╭─[golden:4:1] 4 | 4 │ 5 | 5 │ nah = fn (maybe_foo : Maybe(Int)) -> 6 | 6 │ match maybe_foo with 7 | 7 │ | Just -> unit 8 | · ──┬─ 9 | · ╰── this expects 1 argument 10 | 8 │ | Nothing -> unit 11 | 9 │ end 12 | ╰──── 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_4.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Maybe(a) = Just(a) | Nothing 4 | 5 | nah = fn (maybe_foo : Maybe(Int)) -> 6 | match maybe_foo with 7 | | Just(n) -> unit 8 | | Nothing(a) -> unit 9 | end 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_4.error: -------------------------------------------------------------------------------- 1 | 2 | × wrong number of arguments 3 | ╭─[golden:5:1] 4 | 5 │ nah = fn (maybe_foo : Maybe(Int)) -> 5 | 6 │ match maybe_foo with 6 | 7 │ | Just(n) -> unit 7 | 8 │ | Nothing(a) -> unit 8 | · ─────┬──── 9 | · ╰── this expects no arguments 10 | 9 │ end 11 | ╰──── 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_5.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Maybe(a) = Just(a) | Nothing 4 | 5 | nah = fn (maybe_foo : Maybe(Int)): Int -> 6 | match maybe_foo with 7 | | Just(n) -> unit 8 | | Nothing -> unit 9 | end 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_5.error: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[golden:4:1] 4 | 4 │ 5 | 5 │ nah = fn (maybe_foo : Maybe(Int)): Int -> 6 | 6 │ match maybe_foo with 7 | 7 │ | Just(n) -> unit 8 | · ──┬─ 9 | · ╰── here 10 | 8 │ | Nothing -> unit 11 | 9 │ end 12 | ╰──── 13 | help: expected Int 14 | got Unit 15 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_6.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Maybe(a) = Just(a) | Nothing 4 | 5 | nah = fn (dunno : a): Int -> 6 | match dunno with 7 | | Just(n) -> unit 8 | | Nothing -> unit 9 | end 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/match_unification_error_6.error: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[golden:4:1] 4 | 4 │ 5 | 5 │ nah = fn (dunno : a): Int -> 6 | 6 │ match dunno with 7 | 7 │ | Just(n) -> unit 8 | · ───┬─── 9 | · ╰── here 10 | 8 │ | Nothing -> unit 11 | 9 │ end 12 | ╰──── 13 | help: expected a 14 | got Maybe($2) 15 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/module_not_found.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Missing.Module 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/module_not_found.error: -------------------------------------------------------------------------------- 1 | 2 | × module not found 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ import Missing.Module 7 | · ───────┬────── 8 | · ╰── not found 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/module_not_found_in_package.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import (test-stuff) Missing.Module 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/module_not_found_in_package.error: -------------------------------------------------------------------------------- 1 | 2 | × module not found 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ import (test-stuff) Missing.Module 7 | · ───────┬────── 8 | · ╰── `test-stuff` doesn't expose this module? 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/no_visible_constructors.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import (test-stuff) Data.Stuff (Abstract(..)) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/no_visible_constructors.error: -------------------------------------------------------------------------------- 1 | 2 | × no visible constructors 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ import (test-stuff) Data.Stuff (Abstract(..)) 7 | · ──┬─ 8 | · ╰── `Abstract` type is private 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/not_a_function_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | identity_int = fn (n : Int) -> n 4 | 5 | huh = identity_int(5)() 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/not_a_function_0.error: -------------------------------------------------------------------------------- 1 | 2 | × expression isn't callable 3 | ╭─[golden:2:1] 4 | 2 │ 5 | 3 │ identity_int = fn (n : Int) -> n 6 | 4 │ 7 | 5 │ huh = identity_int(5)() 8 | · ───────┬─────── 9 | · ╰── can't call this 10 | ╰──── 11 | help: expression has type: Int 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/not_a_function_1.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | huh = 5 |> 5 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/not_a_function_1.error: -------------------------------------------------------------------------------- 1 | 2 | × expression isn't callable 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ huh = 5 |> 5 7 | · ┬ 8 | · ╰── can't call this 9 | ╰──── 10 | help: expression has type: Int 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/package_not_found.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import (missing-package) Missing.Module 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/package_not_found.error: -------------------------------------------------------------------------------- 1 | 2 | × package not found 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ import (missing-package) Missing.Module 7 | · ───────┬─────── 8 | · ╰── not installed 9 | ╰──── 10 | help: try adding `missing-package` to your dependencies? 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/rebound_import_constructor.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Data.Stuff ( 4 | Maybe(..) 5 | ) 6 | import More.Stuff as S ( 7 | Kinda(..) 8 | ) 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/rebound_import_type.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Data.Stuff ( 4 | Five 5 | ) 6 | 7 | import (test-stuff) Data.Stuff as S ( 8 | Five 9 | ) 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/rebound_import_value.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Data.Stuff ( 4 | id 5 | ) 6 | 7 | import (test-stuff) Data.Stuff as S ( 8 | id 9 | ) 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/record_unification_error_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | nah = fn (x : { foo: Int, bar: Int, baz: Float }) -> 4 | [x.foo, x.bar, x.baz] 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/record_unification_error_0.error: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ nah = fn (x : { foo: Int, bar: Int, baz: Float }) -> 7 | 4 │ [x.foo, x.bar, x.baz] 8 | · ──┬── 9 | · ╰── here 10 | ╰──── 11 | help: expected Int 12 | got Float 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/row_unification_error_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | foo = fn (r : { r | foo: Unit}): r -> unit 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/row_unification_error_0.error: -------------------------------------------------------------------------------- 1 | 2 | × kinds don't unify 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ foo = fn (r : { r | foo: Unit}): r -> unit 7 | · ┬ 8 | · ╰── here 9 | ╰──── 10 | help: expected Type 11 | got Row 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/row_unification_error_1.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type ExtensibleProps(r) = ExtensibleProps({ r | foo: Int }) 4 | 5 | type BadExtension = Bad(ExtensibleProps(Int)) 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/type_argument_length_mismatch_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | fives : Array(Int, Bool) = [1, 2, 3] 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/type_argument_length_mismatch_0.error: -------------------------------------------------------------------------------- 1 | 2 | × wrong number of type parameters 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ fives : Array(Int, Bool) = [1, 2, 3] 7 | · ──┬── 8 | · ╰── this expects 1 type parameter 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/type_not_a_function_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | huh : Bool(Int) = True 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/type_not_a_function_0.error: -------------------------------------------------------------------------------- 1 | 2 | × type isn't callable 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ huh : Bool(Int) = True 7 | · ──┬─ 8 | · ╰── this type takes no parameters 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unification_error_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | five : Int = 5.0 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unification_error_0.error: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ five : Int = 5.0 7 | · ─┬─ 8 | · ╰── here 9 | ╰──── 10 | help: expected Int 11 | got Float 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unification_error_1.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | my_fn = fn (n : Int) -> n 4 | 5 | five = my_fn(5.0) 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unification_error_1.error: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[golden:2:1] 4 | 2 │ 5 | 3 │ my_fn = fn (n : Int) -> n 6 | 4 │ 7 | 5 │ five = my_fn(5.0) 8 | · ─┬─ 9 | · ╰── here 10 | ╰──── 11 | help: expected Int 12 | got Float 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unification_error_2.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | five = if true then 5 else "5" 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unification_error_2.error: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ five = if true then 5 else "5" 7 | · ─┬─ 8 | · ╰── here 9 | ╰──── 10 | help: expected Int 11 | got String 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unification_error_3.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | not_five = if "false" then 5 else 4 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unification_error_3.error: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ not_five = if "false" then 5 else 4 7 | · ───┬─── 8 | · ╰── here 9 | ╰──── 10 | help: expected Bool 11 | got String 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unification_error_4.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | identity_int = fn (n: Int): Int -> n 4 | 5 | huh = "nope" |> identity_int 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unification_error_4.error: -------------------------------------------------------------------------------- 1 | 2 | × types don't unify 3 | ╭─[golden:2:1] 4 | 2 │ 5 | 3 │ identity_int = fn (n: Int): Int -> n 6 | 4 │ 7 | 5 │ huh = "nope" |> identity_int 8 | · ───┬── 9 | · ╰── here 10 | ╰──── 11 | help: expected Int 12 | got String 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_constructor.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | bang = Nada 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_constructor.error: -------------------------------------------------------------------------------- 1 | 2 | × unknown constructor 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ bang = Nada 7 | · ──┬─ 8 | · ╰── not in scope 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_constructor_qualified.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | -- TODO error should mention that the module isn't imported 4 | bang = NotImported.Constructor 5 | 6 | -- TODO we also want to split out a "module doesn't export that" error at some point too 7 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_constructor_typo.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | 4 | type Five = Five 5 | 6 | suggest = Fide 7 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_constructor_typo.error: -------------------------------------------------------------------------------- 1 | 2 | × unknown constructor 3 | ╭─[golden:3:1] 4 | 3 │ 5 | 4 │ type Five = Five 6 | 5 │ 7 | 6 │ suggest = Fide 8 | · ──┬─ 9 | · ╰── not in scope 10 | ╰──── 11 | help: did you mean `Five`? 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_type_constructor.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | wut = fn (eh: NotReal) -> unit 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_type_constructor.error: -------------------------------------------------------------------------------- 1 | 2 | × unknown type constructor 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ wut = fn (eh: NotReal) -> unit 7 | · ───┬─── 8 | · ╰── not in scope 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_type_export.ditto: -------------------------------------------------------------------------------- 1 | module Test exports ( 2 | Huh 3 | ) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_type_export.error: -------------------------------------------------------------------------------- 1 | 2 | × unknown type export 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports ( 5 | 2 │ Huh 6 | · ─┬─ 7 | · ╰── this type isn't defined? 8 | 3 │ ) 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_type_import.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Data.Stuff (Nope) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_type_import.error: -------------------------------------------------------------------------------- 1 | 2 | × unknown type import 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ import Data.Stuff (Nope) 7 | · ──┬─ 8 | · ╰── this type isn't exposed? 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_type_variable.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Foo = Foo(a) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_type_variable.error: -------------------------------------------------------------------------------- 1 | 2 | × unknown type variable 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ type Foo = Foo(a) 7 | · ┬ 8 | · ╰── not in scope 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_value_export.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (huh) 2 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_value_export.error: -------------------------------------------------------------------------------- 1 | 2 | × unknown value export 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (huh) 5 | · ─┬─ 6 | · ╰── this value isn't defined? 7 | ╰──── 8 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_value_import.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Data.Stuff (nope) 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_value_import.error: -------------------------------------------------------------------------------- 1 | 2 | × unknown value import 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ import Data.Stuff (nope) 7 | · ──┬─ 8 | · ╰── this value isn't exposed? 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_variable.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | bang = nada 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_variable.error: -------------------------------------------------------------------------------- 1 | 2 | × unknown variable 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ bang = nada 7 | · ──┬─ 8 | · ╰── not in scope 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_variable_qualified.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | -- TODO error should mention that the module isn't imported 4 | bang = NotImported.variable 5 | 6 | -- TODO we also want to split out a "module doesn't export that" error at some point too 7 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_variable_typo.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | five = 5 4 | 5 | suggest = fide 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/type-errors/unknown_variable_typo.error: -------------------------------------------------------------------------------- 1 | 2 | × unknown variable 3 | ╭─[golden:2:1] 4 | 2 │ 5 | 3 │ five = 5 6 | 4 │ 7 | 5 │ suggest = fide 8 | · ──┬─ 9 | · ╰── not in scope 10 | ╰──── 11 | help: did you mean `five`? 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/duplicate_type_export.ditto: -------------------------------------------------------------------------------- 1 | module Test exports ( 2 | Foo(..), 3 | Bar(..), 4 | Foo(..), 5 | ) 6 | 7 | type Foo = Foo 8 | type Bar = Bar 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/duplicate_type_export.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ duplicate type export 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports ( 5 | 2 │ Foo(..), 6 | · ─┬─ 7 | · ╰── previously exported here 8 | 3 │ Bar(..), 9 | 4 │ Foo(..), 10 | · ─┬─ 11 | · ╰── already exported 12 | 5 │ ) 13 | 6 │ 14 | 7 │ type Foo = Foo 15 | ╰──── 16 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/duplicate_type_import.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Data.Stuff (Five, Five, five_ctor) 4 | 5 | my_five : Five = five_ctor 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/duplicate_type_import.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ duplicate type import 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ import Data.Stuff (Five, Five, five_ctor) 7 | · ──┬─ ──┬─ 8 | · │ ╰── already imported 9 | · ╰── previously imported here 10 | 4 │ 11 | 5 │ my_five : Five = five_ctor 12 | ╰──── 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/duplicate_value_export.ditto: -------------------------------------------------------------------------------- 1 | module Test exports ( 2 | foo, 3 | bar, 4 | foo, 5 | ) 6 | 7 | foo = unit 8 | bar = unit 9 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/duplicate_value_export.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ duplicate value export 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports ( 5 | 2 │ foo, 6 | · ─┬─ 7 | · ╰── previously exported here 8 | 3 │ bar, 9 | 4 │ foo, 10 | · ─┬─ 11 | · ╰── already exported 12 | 5 │ ) 13 | 6 │ 14 | 7 │ foo = unit 15 | ╰──── 16 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/duplicate_value_import.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Data.Stuff (id, id) 4 | 5 | my_id = id 6 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/duplicate_value_import.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ duplicate value import 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ import Data.Stuff (id, id) 7 | · ─┬ ─┬ 8 | · │ ╰── already imported 9 | · ╰── previously imported here 10 | 4 │ 11 | 5 │ my_id = id 12 | ╰──── 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/redundant_pattern_0.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Option(a) = Some(a) | None 4 | 5 | redundant = fn (o: Option(a)): Float -> 6 | match o with 7 | | _x -> 5.0 8 | | None -> 5.0 9 | end 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/redundant_pattern_0.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ redundant match pattern 3 | ╭─[golden:5:1] 4 | 5 │ redundant = fn (o: Option(a)): Float -> 5 | 6 │ match o with 6 | 7 │ | _x -> 5.0 7 | 8 │ | None -> 5.0 8 | · ──┬─ 9 | · ╰── unreachable 10 | 9 │ end 11 | ╰──── 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/redundant_pattern_1.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Five = Five 4 | 5 | redundant: Float = 6 | match Five with 7 | | Five -> 5.0 8 | | Five -> 5.0 9 | end 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/redundant_pattern_1.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ redundant match pattern 3 | ╭─[golden:5:1] 4 | 5 │ redundant: Float = 5 | 6 │ match Five with 6 | 7 │ | Five -> 5.0 7 | 8 │ | Five -> 5.0 8 | · ──┬─ 9 | · ╰── unreachable 10 | 9 │ end 11 | ╰──── 12 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/redundant_patterns.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Option(a) = Some(a) | None 4 | 5 | redundant = fn (o: Option(a)): Float -> 6 | match o with 7 | | _x -> 5.0 8 | | Some(_x) -> 5.0 9 | | None -> 5.0 10 | end 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_effect_binder.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | get_name : Effect(String) = do { 4 | return "jane" 5 | } 6 | 7 | greet : Effect(Unit) = do { 8 | name <- get_name; 9 | return unit 10 | } 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_effect_binder.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused effect binder 3 | ╭─[golden:5:1] 4 | 5 │ } 5 | 6 │ 6 | 7 │ greet : Effect(Unit) = do { 7 | 8 │ name <- get_name; 8 | · ──┬─ 9 | · ╰── this isn't used 10 | 9 │ return unit 11 | 10 │ } 12 | ╰──── 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_foreign_value.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | foreign five : Int 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_foreign_value.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused foreign value 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ foreign five : Int 7 | · ─────────┬──────── 8 | · ╰── this isn't being used 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_function_binder.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | always_five = fn (ignore) -> 5 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_function_binder.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused function binder 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ always_five = fn (ignore) -> 5 7 | · ───┬── 8 | · ╰── this isn't used 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_import.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import Data.Stuff 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_import.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused import 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ import Data.Stuff 7 | · ────────┬──────── 8 | · ╰── not needed 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_pattern_binder.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | type Option(a) = Some(a) | None 4 | 5 | not_used = fn (o: Option(a)): Float -> 6 | match o with 7 | | Some(a) -> 5.0 8 | | None -> 5.0 9 | end 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_pattern_binder.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused patter binder 3 | ╭─[golden:4:1] 4 | 4 │ 5 | 5 │ not_used = fn (o: Option(a)): Float -> 6 | 6 │ match o with 7 | 7 │ | Some(a) -> 5.0 8 | · ┬ 9 | · ╰── this isn't used 10 | 8 │ | None -> 5.0 11 | 9 │ end 12 | ╰──── 13 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_type_constructors.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (Foo) 2 | 3 | type Foo = Foo 4 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_type_constructors.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused type constructors 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (Foo) 5 | 2 │ 6 | 3 │ type Foo = Foo 7 | · ─┬─ 8 | · ╰── type is never constructed 9 | ╰──── 10 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_type_declaration.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (Foo) 2 | 3 | type Foo 4 | type Bar 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_type_declaration.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused type declaration 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (Foo) 5 | 2 │ 6 | 3 │ type Foo 7 | 4 │ type Bar 8 | · ─┬─ 9 | · ╰── this isn't referenced or exported 10 | ╰──── 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_value_declaration.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (yes) 2 | 3 | yes = true 4 | no = false 5 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/golden/warnings/unused_value_declaration.warnings: -------------------------------------------------------------------------------- 1 | 2 | ⚠ unused top-level value 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (yes) 5 | 2 │ 6 | 3 │ yes = true 7 | 4 │ no = false 8 | · ─┬ 9 | · ╰── this isn't referenced or exported 10 | ╰──── 11 | -------------------------------------------------------------------------------- /crates/ditto-checker/tests/trycmd_tests.rs: -------------------------------------------------------------------------------- 1 | #[test] 2 | fn checker_tests() { 3 | trycmd::TestCases::new().case("tests/cmd/*/*.toml"); 4 | } 5 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/.ignore: -------------------------------------------------------------------------------- 1 | *.in -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_custom_name/test.out/vanilla-pkg/.gitignore: -------------------------------------------------------------------------------- 1 | .ditto -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_custom_name/test.out/vanilla-pkg/ditto-src/Custom.ditto: -------------------------------------------------------------------------------- 1 | module Custom exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_custom_name/test.out/vanilla-pkg/ditto.toml: -------------------------------------------------------------------------------- 1 | # Welcome to your new ditto project! 2 | # 3 | # Options for this file can be found at: 4 | # https://github.com/ditto-lang/ditto/tree/test/crates/ditto-config#readme 5 | name = "custom" 6 | targets = [] 7 | dependencies = [] 8 | test-dependencies = [] 9 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_custom_name/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/bootstrap_custom_name/test.stderr -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_custom_name/test.stdout: -------------------------------------------------------------------------------- 1 | Writing files... 2 | Wrote vanilla-pkg/ditto.toml 3 | Wrote vanilla-pkg/ditto-src/Custom.ditto 4 | Wrote vanilla-pkg/.gitignore 5 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_custom_name/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["bootstrap", "--no-make", "--name", "custom", "vanilla-pkg"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_dir_exists/test.in/vanilla-pkg/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/bootstrap_dir_exists/test.in/vanilla-pkg/.keep -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_dir_exists/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × path "vanilla-pkg" already exists 3 | 4 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_dir_exists/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/bootstrap_dir_exists/test.stdout -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_dir_exists/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["bootstrap", "--no-make", "vanilla-pkg"] 3 | fs.sandbox = true 4 | status = "failed" 5 | 6 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_invalid_package_name/test.stderr: -------------------------------------------------------------------------------- 1 | error: "not_quite" is not a valid package name 2 | 3 | Usage: ditto bootstrap [OPTIONS] 4 | 5 | For more information try '--help' 6 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_invalid_package_name/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/bootstrap_invalid_package_name/test.stdout -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_invalid_package_name/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["bootstrap", "--no-make", "--name", "not_quite", "vanilla-pkg"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_invalid_package_name_from_dir/test.stderr: -------------------------------------------------------------------------------- 1 | error: "not_quite" cannot be used as a package name 2 | 3 | Usage: ditto bootstrap [OPTIONS] 4 | 5 | For more information try '--help' 6 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_invalid_package_name_from_dir/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/bootstrap_invalid_package_name_from_dir/test.stdout -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_invalid_package_name_from_dir/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["bootstrap", "--no-make", "pkgs/not_quite"] 3 | fs.sandbox = true 4 | status = "failed" 5 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_javascript/test.out/js-pkg/.gitignore: -------------------------------------------------------------------------------- 1 | .ditto 2 | dist 3 | node_modules -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_javascript/test.out/js-pkg/ditto-src/JsPkg.ditto: -------------------------------------------------------------------------------- 1 | module JsPkg exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_javascript/test.out/js-pkg/ditto.toml: -------------------------------------------------------------------------------- 1 | # Welcome to your new ditto project! 2 | # 3 | # Options for this file can be found at: 4 | # https://github.com/ditto-lang/ditto/tree/test/crates/ditto-config#readme 5 | name = "js-pkg" 6 | targets = ["nodejs"] 7 | dependencies = [] 8 | test-dependencies = [] 9 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_javascript/test.out/js-pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "module", 4 | "workspaces": [ 5 | "packages/*" 6 | ] 7 | } -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_javascript/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/bootstrap_javascript/test.stderr -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_javascript/test.stdout: -------------------------------------------------------------------------------- 1 | Writing files... 2 | Wrote js-pkg/ditto.toml 3 | Wrote js-pkg/ditto-src/JsPkg.ditto 4 | Wrote js-pkg/.gitignore 5 | Wrote js-pkg/package.json 6 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_javascript/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["bootstrap", "--no-make", "--js", "js-pkg"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_nested_dir/test.out/pkgs/vanilla-pkg/.gitignore: -------------------------------------------------------------------------------- 1 | .ditto -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_nested_dir/test.out/pkgs/vanilla-pkg/ditto-src/VanillaPkg.ditto: -------------------------------------------------------------------------------- 1 | module VanillaPkg exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_nested_dir/test.out/pkgs/vanilla-pkg/ditto.toml: -------------------------------------------------------------------------------- 1 | # Welcome to your new ditto project! 2 | # 3 | # Options for this file can be found at: 4 | # https://github.com/ditto-lang/ditto/tree/test/crates/ditto-config#readme 5 | name = "vanilla-pkg" 6 | targets = [] 7 | dependencies = [] 8 | test-dependencies = [] 9 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_nested_dir/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/bootstrap_nested_dir/test.stderr -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_nested_dir/test.stdout: -------------------------------------------------------------------------------- 1 | Writing files... 2 | Wrote pkgs/vanilla-pkg/ditto.toml 3 | Wrote pkgs/vanilla-pkg/ditto-src/VanillaPkg.ditto 4 | Wrote pkgs/vanilla-pkg/.gitignore 5 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_nested_dir/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["bootstrap", "--no-make", "pkgs/vanilla-pkg"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_vanilla/test.out/vanilla-pkg/.gitignore: -------------------------------------------------------------------------------- 1 | .ditto -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_vanilla/test.out/vanilla-pkg/ditto-src/VanillaPkg.ditto: -------------------------------------------------------------------------------- 1 | module VanillaPkg exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_vanilla/test.out/vanilla-pkg/ditto.toml: -------------------------------------------------------------------------------- 1 | # Welcome to your new ditto project! 2 | # 3 | # Options for this file can be found at: 4 | # https://github.com/ditto-lang/ditto/tree/test/crates/ditto-config#readme 5 | name = "vanilla-pkg" 6 | targets = [] 7 | dependencies = [] 8 | test-dependencies = [] 9 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_vanilla/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/bootstrap_vanilla/test.stderr -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_vanilla/test.stdout: -------------------------------------------------------------------------------- 1 | Writing files... 2 | Wrote vanilla-pkg/ditto.toml 3 | Wrote vanilla-pkg/ditto-src/VanillaPkg.ditto 4 | Wrote vanilla-pkg/.gitignore 5 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/bootstrap_vanilla/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["bootstrap", "--no-make", "vanilla-pkg"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_both_files_and_stdin/test.in/Bar.ditto: -------------------------------------------------------------------------------- 1 | module Bar exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_both_files_and_stdin/test.in/Foo.ditto: -------------------------------------------------------------------------------- 1 | module Foo exports (..); 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_both_files_and_stdin/test.stderr: -------------------------------------------------------------------------------- 1 | error: Can't specify stdin and input paths 2 | 3 | Usage: ditto fmt [OPTIONS] [PATH]... 4 | 5 | For more information try '--help' 6 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_both_files_and_stdin/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/fmt_both_files_and_stdin/test.stdout -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_both_files_and_stdin/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["fmt", "--stdin", "Foo.ditto", "Bar.ditto"] 3 | status = "failed" 4 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_file_check_error/test.in/Foo.ditto: -------------------------------------------------------------------------------- 1 | module Foo exports(..) -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_file_check_error/test.stderr: -------------------------------------------------------------------------------- 1 | Foo.ditto needs formatting 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_file_check_error/test.stdin: -------------------------------------------------------------------------------- 1 | module 2 | Foo 3 | exports 4 | (..); -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_file_check_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/fmt_file_check_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_file_check_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["fmt", "--check", "Foo.ditto"] 3 | status = "failed" 4 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_files/test.in/Bar.ditto: -------------------------------------------------------------------------------- 1 | module Bar exports (..) -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_files/test.in/Foo.ditto: -------------------------------------------------------------------------------- 1 | module 2 | Foo 3 | exports 4 | (..) -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_files/test.out/Bar.ditto: -------------------------------------------------------------------------------- 1 | module Bar exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_files/test.out/Foo.ditto: -------------------------------------------------------------------------------- 1 | module Foo exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_files/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/fmt_files/test.stdout -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_files/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["fmt", "Foo.ditto", "Bar.ditto"] 3 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_stdin/test.stdin: -------------------------------------------------------------------------------- 1 | module 2 | Foo 3 | exports 4 | (..) -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_stdin/test.stdout: -------------------------------------------------------------------------------- 1 | module Foo exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_stdin/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["fmt", "--stdin"] 3 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_stdin_check_error/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × stdin isn't formatted 3 | 4 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_stdin_check_error/test.stdin: -------------------------------------------------------------------------------- 1 | module 2 | Foo 3 | exports 4 | (..) -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_stdin_check_error/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/fmt_stdin_check_error/test.stdout -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/fmt_stdin_check_error/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["fmt", "--stdin", "--check"] 3 | status = "failed" 4 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_check/test.in/.gitignore: -------------------------------------------------------------------------------- 1 | .ditto -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_check/test.in/ditto-src/VanillaPkg.ditto: -------------------------------------------------------------------------------- 1 | module VanillaPkg exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_check/test.in/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "vanilla-pkg" 2 | targets = [] 3 | dependencies = [] 4 | test-dependencies = [] 5 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_check/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/make_check/test.stderr -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_check/test.stdout: -------------------------------------------------------------------------------- 1 | Checking VanillaPkg 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_check/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["make"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_javascript/test.in/.gitignore: -------------------------------------------------------------------------------- 1 | .ditto 2 | dist 3 | node_modules -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_javascript/test.in/ditto-src/JsPkg.ditto: -------------------------------------------------------------------------------- 1 | module JsPkg exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_javascript/test.in/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "js-pkg" 2 | targets = ["nodejs"] 3 | dependencies = [] 4 | test-dependencies = [] 5 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_javascript/test.in/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "module", 4 | "workspaces": [ 5 | "packages/*" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_javascript/test.out/dist/JsPkg.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_javascript/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cli/tests/cmd/make_javascript/test.stderr -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_javascript/test.stdout: -------------------------------------------------------------------------------- 1 | Checking JsPkg 2 | Generating JavaScript for JsPkg 3 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/make_javascript/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["make"] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/version/test.stdout: -------------------------------------------------------------------------------- 1 | ditto 0.0.0 test 2 | built at: 1970-01-01T00:00:00Z 3 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/cmd/version/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto" 2 | args = ["--version"] 3 | -------------------------------------------------------------------------------- /crates/ditto-cli/tests/trycmd_tests.rs: -------------------------------------------------------------------------------- 1 | #[test] 2 | fn cli_tests() { 3 | trycmd::TestCases::new() 4 | .env("DITTO_TEST_VERSION", "true") 5 | .case("tests/cmd/*/*.toml") 6 | .case("README.md"); 7 | } 8 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/complex_if.js: -------------------------------------------------------------------------------- 1 | const rewritten = 0; 2 | function result(c0, c1, c2, c3, c4) { 3 | return (c0 ? c1 : c2) ? (c3 ? (c4 ? 0 : 1) : 2) : 3; 4 | } 5 | export { result, rewritten }; 6 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/imports.ditto: -------------------------------------------------------------------------------- 1 | module Test.Imports exports (..) 2 | 3 | import (test-stuff) Data.Stuff (id) 4 | import Data.Stuff as S 5 | 6 | my_five = id(S.five) 7 | another_five = id(S.five) 8 | five_type = S.Five 9 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/imports.js: -------------------------------------------------------------------------------- 1 | import { Five as Data$Stuff$Five, five as Data$Stuff$five } from "Data.Stuff"; 2 | import { id as test_stuff$Data$Stuff$id } from "test-stuff/Data.Stuff"; 3 | const five_type = Data$Stuff$Five; 4 | const another_five = test_stuff$Data$Stuff$id(Data$Stuff$five); 5 | const my_five = test_stuff$Data$Stuff$id(Data$Stuff$five); 6 | export { another_five, five_type, my_five }; 7 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/keyword_mangling.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | 4 | const = fn (a) -> fn (b) -> a 5 | 6 | type E = Error(String) 7 | 8 | unwrap_error = fn (Error(msg)) -> msg 9 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/keyword_mangling.js: -------------------------------------------------------------------------------- 1 | function $Error($0) { 2 | return ["Error", $0]; 3 | } 4 | function unwrap_error($0) { 5 | if ($0[0] === "Error") { 6 | const msg = $0[1]; 7 | return msg; 8 | } 9 | throw new Error("Pattern match error"); 10 | } 11 | function $const(a) { 12 | return b => a; 13 | } 14 | export { $Error, $const, unwrap_error }; 15 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/number_literals.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | five : Int = 0000000005 4 | zero : Int = 0 5 | silly_zero : Int = 0000 6 | five_hundred : Int = 0500 7 | 8 | floaty_five : Float = 0000000005.00 9 | floaty_zero : Float = 0.0 10 | silly_floaty_zero : Float = 00000.000 11 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/number_literals.js: -------------------------------------------------------------------------------- 1 | const silly_floaty_zero = 0.0; 2 | const floaty_zero = 0.0; 3 | const floaty_five = 5.0; 4 | const five_hundred = 500; 5 | const silly_zero = 0; 6 | const zero = 0; 7 | const five = 5; 8 | export { 9 | five, 10 | five_hundred, 11 | floaty_five, 12 | floaty_zero, 13 | silly_floaty_zero, 14 | silly_zero, 15 | zero, 16 | }; 17 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/recursive_constants.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | a = b 4 | b = a 5 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/recursive_constants.js: -------------------------------------------------------------------------------- 1 | let a; 2 | let b; 3 | a = b; 4 | b = a; 5 | export { a, b }; 6 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/recursive_functions.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | forever = fn () -> forever() 4 | 5 | cycle_a = fn () -> cycle_b() 6 | cycle_b = fn () -> cycle_a() 7 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/recursive_functions.js: -------------------------------------------------------------------------------- 1 | function cycle_a() { 2 | return cycle_b(); 3 | } 4 | function cycle_b() { 5 | return cycle_a(); 6 | } 7 | function forever() { 8 | return forever(); 9 | } 10 | export { cycle_a, cycle_b, forever }; 11 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/strings.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | 4 | escapes = "\t\n" 5 | 6 | multi_line = " 7 | test 8 | " 9 | 10 | escaped_quotes = "\"\"" 11 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/strings.js: -------------------------------------------------------------------------------- 1 | const escaped_quotes = '""'; 2 | const multi_line = "\ntest\n"; 3 | const escapes = "\t\n"; 4 | export { escaped_quotes, escapes, multi_line }; 5 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/type_declarations.ditto: -------------------------------------------------------------------------------- 1 | module Test exports ( 2 | A(..), 3 | Maybe(..), 4 | Result(..), 5 | Private, 6 | ) 7 | 8 | type A = A 9 | 10 | type Maybe(a) = Just(a) | Nothing 11 | 12 | type Result(a, e) = Ok(a) | Err(e) 13 | 14 | type Private = Private 15 | 16 | type Internal(a, b, c) = Internal(a, b) 17 | 18 | nothing = Nothing 19 | 20 | just_five = Just(5) 21 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/unused_patterns.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | 4 | always_five = fn (_, _, _) -> 5 5 | -------------------------------------------------------------------------------- /crates/ditto-codegen-js/tests/golden/unused_patterns.js: -------------------------------------------------------------------------------- 1 | function always_five(_$0, _$1, _$2) { 2 | return 5; 3 | } 4 | export { always_five }; 5 | -------------------------------------------------------------------------------- /crates/ditto-config/tests/golden/parse-errors/bad_target.error: -------------------------------------------------------------------------------- 1 | 2 | × unknown variant `nah`, expected `web` or `nodejs` for key `targets` at line 1 column 1 3 | -------------------------------------------------------------------------------- /crates/ditto-config/tests/golden/parse-errors/bad_target.toml: -------------------------------------------------------------------------------- 1 | name = "test" 2 | 3 | targets = ["nah"] 4 | -------------------------------------------------------------------------------- /crates/ditto-config/tests/golden/parse-errors/missing_name.error: -------------------------------------------------------------------------------- 1 | 2 | × missing field `name` 3 | -------------------------------------------------------------------------------- /crates/ditto-config/tests/golden/parse-errors/missing_name.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-config/tests/golden/parse-errors/missing_name.toml -------------------------------------------------------------------------------- /crates/ditto-config/tests/golden/parse-errors/syntax_error_0.error: -------------------------------------------------------------------------------- 1 | 2 | × newline in string found at line 1 column 9 3 | -------------------------------------------------------------------------------- /crates/ditto-config/tests/golden/parse-errors/syntax_error_0.toml: -------------------------------------------------------------------------------- 1 | name = " 2 | -------------------------------------------------------------------------------- /crates/ditto-config/tests/golden/parse-errors/syntax_error_1.error: -------------------------------------------------------------------------------- 1 | 2 | × unexpected eof encountered at line 4 column 1 3 | -------------------------------------------------------------------------------- /crates/ditto-config/tests/golden/parse-errors/syntax_error_1.toml: -------------------------------------------------------------------------------- 1 | name = "test" 2 | 3 | targets = [ 4 | -------------------------------------------------------------------------------- /crates/ditto-cst/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | lalrpop::process_root().unwrap(); 3 | } 4 | -------------------------------------------------------------------------------- /crates/ditto-cst/src/parser/tests/mod.rs: -------------------------------------------------------------------------------- 1 | mod declaration; 2 | mod expression; 3 | mod imports; 4 | mod module_header; 5 | mod partials; 6 | mod r#type; 7 | 8 | use crate::Module; 9 | 10 | #[test] 11 | fn it_captures_trailing_module_comments() { 12 | let module = Module::parse("module Test exports (..)\n\n-- comment\n--comment").unwrap(); 13 | assert_eq!(module.trailing_comments.len(), 2) 14 | } 15 | -------------------------------------------------------------------------------- /crates/ditto-cst/tests/golden/parse-errors/bad_package_name.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import (foo_bar) Foo.Bar 4 | -------------------------------------------------------------------------------- /crates/ditto-cst/tests/golden/parse-errors/bad_package_name.error: -------------------------------------------------------------------------------- 1 | 2 | × unexpected token 3 | ╭─[golden:1:1] 4 | 1 │ module Test exports (..) 5 | 2 │ 6 | 3 │ import (foo_bar) Foo.Bar 7 | · ───┬─── 8 | · ╰── here 9 | ╰──── 10 | help: expected "package-name" 11 | -------------------------------------------------------------------------------- /crates/ditto-cst/tests/golden/parse-errors/empty_input.ditto: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-cst/tests/golden/parse-errors/empty_input.ditto -------------------------------------------------------------------------------- /crates/ditto-cst/tests/golden/parse-errors/empty_input.error: -------------------------------------------------------------------------------- 1 | 2 | × unexpected eof 3 | ╭─[golden:1:1] 4 | 1 │ 5 | · ▲ 6 | · ╰── here 7 | ╰──── 8 | help: expected "module" 9 | -------------------------------------------------------------------------------- /crates/ditto-cst/tests/golden/parse-errors/partial_module_header.ditto: -------------------------------------------------------------------------------- 1 | -- test 2 | module 3 | -------------------------------------------------------------------------------- /crates/ditto-cst/tests/golden/parse-errors/partial_module_header.error: -------------------------------------------------------------------------------- 1 | 2 | × unexpected eof 3 | ╭─[golden:1:1] 4 | 1 │ -- test 5 | 2 │ module 6 | · ▲ 7 | · ╰── here 8 | ╰──── 9 | help: expected "ProperName" 10 | -------------------------------------------------------------------------------- /crates/ditto-fmt/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ditto-fmt" 3 | version = "0.0.1" 4 | edition = "2021" 5 | license = "BSD-3-Clause" 6 | 7 | [lib] 8 | doctest = false 9 | 10 | [dependencies] 11 | ditto-cst = { path = "../ditto-cst" } 12 | dprint-core = "0.60" 13 | similar = "2.2" 14 | 15 | [dev-dependencies] 16 | similar-asserts = "1.4" 17 | datatest-stable = "0.1" 18 | 19 | [[test]] 20 | name = "golden_tests" 21 | harness = false -------------------------------------------------------------------------------- /crates/ditto-fmt/src/config.rs: -------------------------------------------------------------------------------- 1 | pub static INDENT_WIDTH: u8 = 4; 2 | pub static MAX_WIDTH: u32 = 80; 3 | -------------------------------------------------------------------------------- /crates/ditto-fmt/tests/golden/empty_module.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | -------------------------------------------------------------------------------- /crates/ditto-fmt/tests/golden/empty_module_with_trailing_comments.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | 4 | -- comment 5 | -------------------------------------------------------------------------------- /crates/ditto-fmt/tests/golden/import_sorting.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..) 2 | 3 | import (a) A 4 | import (a) B 5 | import (a) C 6 | 7 | import (b-c) A 8 | import (b-c) B 9 | import (b-c) C 10 | 11 | import A 12 | import B 13 | import C 14 | -------------------------------------------------------------------------------- /crates/ditto-fmt/tests/golden/newtypes.ditto: -------------------------------------------------------------------------------- 1 | module Newtypes exports (..) 2 | 3 | 4 | type Wrapped(a) = Wrapped(a) 5 | 6 | unwrap = fn (Wrapped(a)) -> a 7 | 8 | is_wrapped_int = fn (Wrapped(_): Wrapped(Int)) -> true 9 | 10 | never = fn (Never.Spin(never): Never.Never) -> never 11 | 12 | both_are_nothing = fn ( 13 | -- testing 14 | Maybe.Nothing, 15 | Maybe.Nothing: Maybe(a), 16 | ): Bool -> true 17 | -------------------------------------------------------------------------------- /crates/ditto-fmt/tests/golden/records.ditto: -------------------------------------------------------------------------------- 1 | module Records exports (..) 2 | 3 | 4 | items = [ 5 | { key = "a", value = unit }, 6 | { key = "b", value = unit }, 7 | { key = "c", value = unit }, 8 | { key = "d", value = unit }, 9 | ] 10 | -------------------------------------------------------------------------------- /crates/ditto-fmt/tests/golden/type_aliases.ditto: -------------------------------------------------------------------------------- 1 | module Type.Aliases exports (..) 2 | 3 | 4 | -- Documentation lorem ipsum whatever 5 | type alias Five = Int 6 | 7 | type alias Six = 8 | -- comment 9 | Float 10 | 11 | type alias WithVariables(a, b, c) = Maybe(a) 12 | 13 | type alias WrapTest = 14 | Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong 15 | -------------------------------------------------------------------------------- /crates/ditto-fmt/tests/golden/type_declarations.ditto: -------------------------------------------------------------------------------- 1 | module Type.Declarations exports (..) 2 | 3 | 4 | -- Documentation lorem ipsum whatever 5 | type Dunno 6 | 7 | type Maybe(a) = 8 | -- comment 9 | | Just(a) 10 | -- comment 11 | | Nothing 12 | -------------------------------------------------------------------------------- /crates/ditto-highlight/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ditto-highlight" 3 | version = "0.0.1" 4 | edition = "2021" 5 | license = "BSD-3-Clause" 6 | 7 | [lib] 8 | doctest = false 9 | 10 | [dependencies] 11 | ditto-tree-sitter = { path = "../ditto-tree-sitter" } 12 | ropey = "1.6" 13 | 14 | [dev-dependencies] 15 | similar-asserts = "1.4" 16 | datatest-stable = "0.1" 17 | 18 | [[test]] 19 | name = "golden_tests" 20 | harness = false 21 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/brackets.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | 4 | brackets = [{}]; 5 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/brackets.html: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | 4 | brackets = [{}]; 5 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/delimiters.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | 4 | fives = [5, 5, 5]; 5 | 6 | type ABC = 7 | | A 8 | | B 9 | | C; 10 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/functions.ditto: -------------------------------------------------------------------------------- 1 | module Test exports ( 2 | five, 3 | ); 4 | 5 | 6 | five = 5; 7 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/functions.html: -------------------------------------------------------------------------------- 1 | module Test exports ( 2 | five, 3 | ); 4 | 5 | 6 | five = 5; 7 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/keywords-conditional.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | 4 | bool = fn (b, x, y) -> if b then x else y; 5 | 6 | unwrap = fn (wrapped) -> 7 | match wrapped with 8 | | Wrapped(x) -> x 9 | end; 10 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/keywords-import.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | import Foo as F; 4 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/keywords-import.html: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | import Foo as F; 4 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/keywords.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | 4 | type Foo = Foo; 5 | 6 | type alias F = Foo; 7 | 8 | foreign is_eq_impl: (Int, Int) -> Bool; 9 | 10 | identity = fn (a) -> a; 11 | 12 | main = do { 13 | return unit 14 | }; 15 | 16 | fives = 17 | let 18 | five = 5; 19 | in 20 | [five, five, five]; 21 | 22 | main = do { 23 | return unit 24 | }; 25 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/literals.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | 4 | literals = [ 5 | "string", 6 | 5, 7 | 5.0, 8 | true, 9 | false, 10 | unit, 11 | ]; 12 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/members.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | 4 | type Maybe(a) = 5 | | Nothing 6 | | Just(a); 7 | 8 | nothing = Nothing; 9 | 10 | is_just = fn (mb) -> 11 | match mb with 12 | | Maybe.Just(_) -> true 13 | | Nothing -> false 14 | end; 15 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/namespace.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | import Some.Module as SM; 4 | 5 | 6 | id = SM.identity; 7 | 8 | unwrap = fn (SM.Pair(x, y)) -> [x, y, SM.z]; 9 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/operators.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | 4 | identity = fn (a: a) -> a; 5 | 6 | is_just = fn (mb: Maybe(a)): Bool -> 7 | match mb with 8 | | Just(_) -> true 9 | | _ -> false 10 | end; 11 | 12 | main = do { 13 | five <- read_five; 14 | let another_five: Int = 15 | five 16 | |> identity; 17 | return unit 18 | }; 19 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/parameters.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | 4 | type Maybe(a) = 5 | | Nothing 6 | | Just(a); 7 | 8 | id = fn (a: a): a -> a; 9 | 10 | update_foo = fn (r: { r | foo: Int }) -> { r | foo = 5 }; 11 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/symbols.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | import Maybe ( 4 | Maybe(..), 5 | ); 6 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/types.ditto: -------------------------------------------------------------------------------- 1 | module Test exports ( 2 | Foo, 3 | Bar(..), 4 | ); 5 | 6 | 7 | type alias T = SomeModule.T(Int); 8 | 9 | type alias Identity(a) = (a) -> a; 10 | -------------------------------------------------------------------------------- /crates/ditto-highlight/tests/golden/variables.ditto: -------------------------------------------------------------------------------- 1 | module Test exports (..); 2 | 3 | 4 | identity = fn (a) -> a; 5 | -------------------------------------------------------------------------------- /crates/ditto-lsp/fixtures/.ignore: -------------------------------------------------------------------------------- 1 | # For cargo-watch 2 | * 3 | -------------------------------------------------------------------------------- /crates/ditto-lsp/fixtures/diagnostics-0/ditto-src/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (five) 2 | 3 | five : String = 5 4 | 5 | -------------------------------------------------------------------------------- /crates/ditto-lsp/fixtures/diagnostics-0/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "test" -------------------------------------------------------------------------------- /crates/ditto-lsp/fixtures/diagnostics-1/.ditto/packages/core/ditto-src/B.ditto: -------------------------------------------------------------------------------- 1 | module B exports (five) 2 | 3 | import C 4 | 5 | five = C.five 6 | -------------------------------------------------------------------------------- /crates/ditto-lsp/fixtures/diagnostics-1/.ditto/packages/core/ditto-src/C.ditto: -------------------------------------------------------------------------------- 1 | module C exports (five) 2 | 3 | five : Int = 5 4 | -------------------------------------------------------------------------------- /crates/ditto-lsp/fixtures/diagnostics-1/.ditto/packages/core/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "core" -------------------------------------------------------------------------------- /crates/ditto-lsp/fixtures/diagnostics-1/ditto-src/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (five) 2 | 3 | import (core) B 4 | 5 | five : String = B.five 6 | -------------------------------------------------------------------------------- /crates/ditto-lsp/fixtures/diagnostics-1/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "test" -------------------------------------------------------------------------------- /crates/ditto-lsp/fixtures/formatting/Example.ditto: -------------------------------------------------------------------------------- 1 | module Example exports ( 2 | five 3 | 4 | ) 5 | 6 | 7 | -- comment 8 | five:Int = 5 9 | 10 | 11 | emoji_shrug = "🤷" -- comment 12 | ascii_shrug = "¯\\_(ツ)_/¯" -- comment 13 | 14 | 15 | -------------------------------------------------------------------------------- /crates/ditto-lsp/fixtures/semantic-tokens/Example.ditto: -------------------------------------------------------------------------------- 1 | module Example exports (..) 2 | 3 | 4 | -- comment 5 | example: String = "example" 6 | -------------------------------------------------------------------------------- /crates/ditto-lsp/lsp-test/ditto-lsp-test.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: >= 1.10 2 | 3 | name: ditto-lsp-test 4 | version: 1.0.0 5 | build-type: Simple 6 | 7 | executable ditto-lsp-test 8 | main-is: Main.hs 9 | build-depends: base, text, process, lsp-test, lsp-types 10 | default-language: Haskell2010 11 | -------------------------------------------------------------------------------- /crates/ditto-make/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![doc = include_str!("../README.md")] 2 | #![feature(type_alias_impl_trait)] 3 | #![warn(missing_docs)] 4 | 5 | mod build_ninja; 6 | mod common; 7 | mod compile; 8 | mod utils; 9 | 10 | pub use build_ninja::{generate_build_ninja, BuildNinja, GetWarnings, PackageSources, Sources}; 11 | pub use compile::{command as command_compile, run as run_compile}; 12 | pub use utils::find_ditto_files; 13 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/.ignore: -------------------------------------------------------------------------------- 1 | *.in -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/all-good/test.in/dep/ditto-src/Dep.ditto: -------------------------------------------------------------------------------- 1 | module Dep exports (..) 2 | 3 | import Util (identity) 4 | 5 | type Dep = Dep 6 | 7 | dep : Dep = identity(Dep) 8 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/all-good/test.in/dep/ditto-src/Util.ditto: -------------------------------------------------------------------------------- 1 | module Util exports (identity) 2 | 3 | identity = fn (x) -> x 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/all-good/test.in/dep/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "dep" 2 | targets = ["web", "nodejs"] 3 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/all-good/test.in/ditto-src/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (..) 2 | 3 | type A = A 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/all-good/test.in/ditto-src/B.ditto: -------------------------------------------------------------------------------- 1 | module B exports (..) 2 | 3 | type B = B 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/all-good/test.in/ditto-src/C.ditto: -------------------------------------------------------------------------------- 1 | module C exports (..) 2 | 3 | import A 4 | import B 5 | 6 | type C = C(B.B, A.A) 7 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/all-good/test.in/ditto-src/D.ditto: -------------------------------------------------------------------------------- 1 | module D exports (..) 2 | 3 | import C (C) 4 | import (dep) Dep 5 | 6 | type D = D(Dep.Dep, C) 7 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/all-good/test.in/ditto-src/D/E.ditto: -------------------------------------------------------------------------------- 1 | module D.E exports (..) 2 | 3 | type E = E 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/all-good/test.in/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "test" 2 | dependencies = ["dep"] 3 | targets = ["web"] 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/all-good/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-make/tests/cmd/all-good/test.stderr -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/all-good/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-make-testbin" 2 | args = [] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/duplicate-module-name/test.in/ditto-src/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (..) 2 | 3 | type A = A 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/duplicate-module-name/test.in/ditto-src/B.ditto: -------------------------------------------------------------------------------- 1 | module A exports (..) 2 | 3 | type B = B 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/duplicate-module-name/test.in/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "test" 2 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/duplicate-module-name/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × module name `A` is taken 3 | ╭─[./ditto-src/B.ditto:1:1] 4 | 1 │ module A exports (..) 5 | · ┬ 6 | · ╰── module name is used by ./ditto-src/A.ditto 7 | 2 │ 8 | ╰──── 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/duplicate-module-name/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-make/tests/cmd/duplicate-module-name/test.stdout -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/duplicate-module-name/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-make-testbin" 2 | args = [] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/missing-module/test.in/ditto-src/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (..) 2 | 3 | import B 4 | 5 | type A = A 6 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/missing-module/test.in/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "test" 2 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/missing-module/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-make/tests/cmd/missing-module/test.stderr -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/missing-module/test.stdout: -------------------------------------------------------------------------------- 1 | builddir = builddir 2 | 3 | rule ast 4 | command = ditto compile ast --build-dir builddir -i ${in} -o ${out} 5 | 6 | build builddir/A.ast builddir/A.ast-exports builddir/A.checker-warnings: ast ./ditto-src/A.ditto 7 | description = Checking A 8 | 9 | 10 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/missing-module/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-make-testbin" 2 | args = [] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/module-cycle/test.in/ditto-src/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (..) 2 | 3 | import B 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/module-cycle/test.in/ditto-src/B.ditto: -------------------------------------------------------------------------------- 1 | module B exports (..) 2 | 3 | import A 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/module-cycle/test.in/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "test" 2 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/module-cycle/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × modules form a cycle: `A`, `B` 3 | 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/module-cycle/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-make/tests/cmd/module-cycle/test.stdout -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/module-cycle/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-make-testbin" 2 | args = [] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/no-codegen/test.in/dep/ditto-src/Dep.ditto: -------------------------------------------------------------------------------- 1 | module Dep exports (..) 2 | 3 | type Dep = Dep 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/no-codegen/test.in/dep/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "dep" 2 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/no-codegen/test.in/ditto-src/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (..) 2 | 3 | type A = A 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/no-codegen/test.in/ditto-src/B.ditto: -------------------------------------------------------------------------------- 1 | module B exports (..) 2 | 3 | type B = B 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/no-codegen/test.in/ditto-src/C.ditto: -------------------------------------------------------------------------------- 1 | module C exports (..) 2 | 3 | import A 4 | import B 5 | 6 | type C = C(B.B, A.A) 7 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/no-codegen/test.in/ditto-src/D.ditto: -------------------------------------------------------------------------------- 1 | module D exports (..) 2 | 3 | import C (C) 4 | import (dep) Dep 5 | 6 | type D = D(Dep.Dep, C) 7 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/no-codegen/test.in/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "test" 2 | dependencies = ["dep"] 3 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/no-codegen/test.stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-make/tests/cmd/no-codegen/test.stderr -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/no-codegen/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-make-testbin" 2 | args = [] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/self-referencing-module/test.in/ditto-src/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (..) 2 | 3 | import A 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/self-referencing-module/test.in/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "test" 2 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/self-referencing-module/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × module `A` can't import itself! 3 | 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/self-referencing-module/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-make/tests/cmd/self-referencing-module/test.stdout -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/self-referencing-module/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-make-testbin" 2 | args = [] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/target-mismatch/test.in/dep/ditto-src/Dep.ditto: -------------------------------------------------------------------------------- 1 | module Dep exports (..) 2 | 3 | type Dep = Dep 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/target-mismatch/test.in/dep/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "dep" 2 | targets = ["nodejs"] 3 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/target-mismatch/test.in/ditto-src/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (..) 2 | 3 | type A = A 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/target-mismatch/test.in/ditto-src/B.ditto: -------------------------------------------------------------------------------- 1 | module B exports (..) 2 | 3 | type B = B 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/target-mismatch/test.in/ditto-src/C.ditto: -------------------------------------------------------------------------------- 1 | module C exports (..) 2 | 3 | import A 4 | import B 5 | 6 | type C = C(B.B, A.A) 7 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/target-mismatch/test.in/ditto-src/D.ditto: -------------------------------------------------------------------------------- 1 | module D exports (..) 2 | 3 | import C (C) 4 | import (dep) Dep 5 | 6 | type D = D(Dep.Dep, C) 7 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/target-mismatch/test.in/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "test" 2 | dependencies = ["dep"] 3 | targets = ["web"] 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/target-mismatch/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × package "dep" doesn't support targets: "web" 3 | 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/target-mismatch/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-make/tests/cmd/target-mismatch/test.stdout -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/target-mismatch/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-make-testbin" 2 | args = [] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/unsupported-ditto-version/test.in/ditto-src/A.ditto: -------------------------------------------------------------------------------- 1 | module A exports (..) 2 | 3 | import B 4 | 5 | type A = A 6 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/unsupported-ditto-version/test.in/ditto.toml: -------------------------------------------------------------------------------- 1 | name = "test" 2 | ditto-version = "^1.0.0" 3 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/unsupported-ditto-version/test.stderr: -------------------------------------------------------------------------------- 1 | 2 | × ditto version requirement not met for current package: current version = 3 | │ 0.0.0-test, wanted = ^1.0.0 4 | 5 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/unsupported-ditto-version/test.stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditto-lang/ditto/3f00102f44bc0eef102a2f6bfdfa5fe9b799e5ed/crates/ditto-make/tests/cmd/unsupported-ditto-version/test.stdout -------------------------------------------------------------------------------- /crates/ditto-make/tests/cmd/unsupported-ditto-version/test.toml: -------------------------------------------------------------------------------- 1 | bin.name = "ditto-make-testbin" 2 | args = [] 3 | fs.sandbox = true 4 | -------------------------------------------------------------------------------- /crates/ditto-make/tests/trycmd_tests.rs: -------------------------------------------------------------------------------- 1 | #[test] 2 | fn checker_tests() { 3 | trycmd::TestCases::new() 4 | .case("tests/cmd/*/*.toml") 5 | .case("README.md"); 6 | } 7 | -------------------------------------------------------------------------------- /crates/ditto-tree-sitter/README.md: -------------------------------------------------------------------------------- 1 | # Vendored `tree-sitter` things 🌴 2 | 3 | This crate exists to pin 4 | [`tree-sitter`](https://github.com/tree-sitter/tree-sitter) and 5 | and [`tree-sitter-ditto`](https://github.com/ditto-lang/tree-sitter-ditto) versions. 6 | 7 | It also [tests](./tests/parsing_tests.rs) that all `.ditto` files in this repo can be parsed with the pinned version of the language grammar 👌 8 | -------------------------------------------------------------------------------- /nixpkgs.nix: -------------------------------------------------------------------------------- 1 | let 2 | nixpkgsRev = "4a66f421319b72adf90c79d5b9ac8b909b29a771"; 3 | nixpkgs = builtins.fetchTarball { 4 | name = "nixpkgs-${nixpkgsRev}"; 5 | url = "https://github.com/nixos/nixpkgs/archive/${nixpkgsRev}.tar.gz"; 6 | sha256 = "1cyc16zjjc2pw8jhs4fsf763xckn63zimd07z3h45k7kz9dq79k3"; 7 | }; 8 | in 9 | import nixpkgs 10 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | # https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file 2 | # https://rust-lang.github.io/rustup-components-history/ 3 | [toolchain] 4 | channel = "nightly-2022-10-13" 5 | profile = "minimal" 6 | components = ["rustfmt", "clippy", "rust-src", "llvm-tools-preview"] 7 | targets = [] 8 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | imports_granularity = "Crate" 2 | -------------------------------------------------------------------------------- /scripts/cst-generator/cst-generator.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: >= 1.10 2 | 3 | name: cst-generator 4 | version: 1.0.0 5 | build-type: Simple 6 | 7 | executable cst-generator 8 | main-is: Main.hs 9 | build-depends: base, transformers, random 10 | default-language: Haskell2010 11 | -------------------------------------------------------------------------------- /scripts/log-analysis/.gitignore: -------------------------------------------------------------------------------- 1 | logs.ndjson 2 | plot.png 3 | -------------------------------------------------------------------------------- /scripts/log-analysis/shell.nix: -------------------------------------------------------------------------------- 1 | let pkgs = import ../../nixpkgs.nix { }; 2 | in pkgs.mkShell { 3 | buildInputs = [ 4 | (pkgs.rWrapper.override { 5 | packages = with pkgs.rPackages; [ 6 | languageserver 7 | jsonlite 8 | dplyr 9 | ggplot2 10 | ]; 11 | }) 12 | ]; 13 | } 14 | -------------------------------------------------------------------------------- /scripts/release/README.md: -------------------------------------------------------------------------------- 1 | # Release generator 2 | 3 | This script is responsible for generating GitHub release artifacts. 4 | 5 | ```sh 6 | # Build the ditto executable 7 | cargo build --release --locked 8 | 9 | # Prepare the release 10 | node scripts/release \ 11 | --ditto-bin target/release/ditto \ 12 | --out-zip ditto-linux.zip \ 13 | --out-sha256 ditto-linux.sha256 14 | ``` 15 | -------------------------------------------------------------------------------- /scripts/release/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "main": "index.js", 4 | "type": "module", 5 | "dependencies": { 6 | "archiver": "5.3.0", 7 | "arg": "5.0.1" 8 | } 9 | } 10 | --------------------------------------------------------------------------------