diff --git a/src/parser/toplevel.lisp b/src/parser/toplevel.lisp index a5a21c362..269fe037b 100644 --- a/src/parser/toplevel.lisp +++ b/src/parser/toplevel.lisp @@ -1953,7 +1953,7 @@ consume all attributes"))) :file file :highlight :end :message "Malformed functional dependency" - :primary-note "expected one ore more type variables"))) + :primary-note "expected one or more type variables"))) (make-fundep :left (loop :for var :in left diff --git a/tests/parser-tests.lisp b/tests/parser-tests.lisp index a4b2aaef2..426c26a4c 100644 --- a/tests/parser-tests.lisp +++ b/tests/parser-tests.lisp @@ -1,21 +1,35 @@ (in-package #:coalton-tests) (deftest test-parser () - (let* ((glob (merge-pathnames "tests/parser/*.bad.coalton" (asdf:system-source-directory "coalton/tests"))) + (labels ((test-files (pattern) + (directory (merge-pathnames pattern (asdf:system-source-directory "coalton/tests")))) - (files (directory glob))) + (parse-file (file) + (with-open-file (stream file) + (parser:with-reader-context stream + (parser:read-program stream (error:make-coalton-file :stream stream :name (namestring file)) :mode :file)))) - (loop :for file :in files - :do (with-open-file (stream file) - (signals parser:parse-error - (parser:with-reader-context stream - (parser:read-program stream (error:make-coalton-file :stream stream :name (namestring file)) :mode :file)))))) + (error-string (condition) + (with-output-to-string (out) + (coalton-impl/error::display-coalton-error out + (slot-value condition 'coalton-impl/error::err)))) + (parse-error-text (file) + (with-open-file (stream file) + (handler-case + (parser:with-reader-context stream + (parser:read-program stream (error:make-coalton-file :stream stream :name "test") :mode :file)) + (error:coalton-base-error (c) + (error-string c)))))) + (loop :for file :in (test-files "tests/parser/*.bad.coalton") + :do (let ((error-file (make-pathname :type "error" + :defaults file))) + (cond ((uiop:file-exists-p error-file) + (check-string= (format nil "expected error ~A (A) and generated error (B)" error-file) + (alexandria:read-file-into-string error-file) + (parse-error-text file))) + (t + (signals parser:parse-error + (parse-file file)))))) - (let* ((glob (merge-pathnames "tests/parser/*.good.coalton" (asdf:system-source-directory "coalton/tests"))) - - (files (directory glob))) - - (loop :for file :in files - :do (with-open-file (stream file) - (parser:with-reader-context stream - (parser:read-program stream (error:make-coalton-file :stream stream :name (namestring file)) :mode :file)))))) + (loop :for file :in (test-files "tests/parser/*.good.coalton") + :do (parse-file file)))) diff --git a/tests/parser/define-class.1.bad.error b/tests/parser/define-class.1.bad.error new file mode 100644 index 000000000..8f28e1917 --- /dev/null +++ b/tests/parser/define-class.1.bad.error @@ -0,0 +1,8 @@ +error: Malformed class definition + --> test:4:15 + | + 4 | (define-class (C)) + | ^ expected class type variable(s) +help: add class type variable `:a` + 4 | (define-class (C :a)) + | ---- diff --git a/tests/parser/define-class.10.bad.error b/tests/parser/define-class.10.bad.error new file mode 100644 index 000000000..7e2216b9f --- /dev/null +++ b/tests/parser/define-class.10.bad.error @@ -0,0 +1,8 @@ +error: Malformed class definition + --> test:4:15 + | + 4 | (define-class ((C) :a)) + | ^^^ unnecessary parentheses +help: remove unnecessary parentheses + 4 | (define-class (C :a)) + | - diff --git a/tests/parser/define-class.11.bad.error b/tests/parser/define-class.11.bad.error new file mode 100644 index 000000000..cf1e27daa --- /dev/null +++ b/tests/parser/define-class.11.bad.error @@ -0,0 +1,5 @@ +error: Malformed class definition + --> test:4:15 + | + 4 | (define-class ("C" :a :b)) + | ^^^ expected symbol diff --git a/tests/parser/define-class.12.bad.error b/tests/parser/define-class.12.bad.error new file mode 100644 index 000000000..03fc918d8 --- /dev/null +++ b/tests/parser/define-class.12.bad.error @@ -0,0 +1,7 @@ +error: Malformed method definition + --> test:5:3 + | + 4 | (define-class (C :a) + | ------ in this class definition + 5 | (0.5 (:a -> :a))) + | ^^^ expected symbol diff --git a/tests/parser/define-class.13.bad.error b/tests/parser/define-class.13.bad.error new file mode 100644 index 000000000..486b78361 --- /dev/null +++ b/tests/parser/define-class.13.bad.error @@ -0,0 +1,5 @@ +error: Malformed class definition + --> test:4:14 + | + 4 | (define-class (C :a . :b)) + | ^^^^^^^^^^^ unexpected dotted list diff --git a/tests/parser/define-class.14.bad.error b/tests/parser/define-class.14.bad.error new file mode 100644 index 000000000..902ac864b --- /dev/null +++ b/tests/parser/define-class.14.bad.error @@ -0,0 +1,5 @@ +error: Malformed functional dependency + --> test:4:34 + | + 4 | (define-class (C :a :b (:a -> :b) :c)) + | ^^ expected a list diff --git a/tests/parser/define-class.15.bad.error b/tests/parser/define-class.15.bad.error new file mode 100644 index 000000000..b19e8544b --- /dev/null +++ b/tests/parser/define-class.15.bad.error @@ -0,0 +1,5 @@ +error: Malformed functional dependency + --> test:4:23 + | + 4 | (define-class (C :a :b (:a :b . :c))) + | ^^^^^^^^^^^^ unexpected dotted list diff --git a/tests/parser/define-class.16.bad.error b/tests/parser/define-class.16.bad.error new file mode 100644 index 000000000..4d198b508 --- /dev/null +++ b/tests/parser/define-class.16.bad.error @@ -0,0 +1,5 @@ +error: Malformed functional dependency + --> test:4:33 + | + 4 | (define-class (C :a :b (:a :b ->))) + | ^ expected one or more type variables diff --git a/tests/parser/define-class.17.bad.error b/tests/parser/define-class.17.bad.error new file mode 100644 index 000000000..2a66cd90a --- /dev/null +++ b/tests/parser/define-class.17.bad.error @@ -0,0 +1,5 @@ +error: Malformed functional dependency + --> test:4:23 + | + 4 | (define-class (C :a :b (-> :b :c))) + | ^^^^^^^^^^ expected one or more type variables diff --git a/tests/parser/define-class.18.bad.error b/tests/parser/define-class.18.bad.error new file mode 100644 index 000000000..badaa2570 --- /dev/null +++ b/tests/parser/define-class.18.bad.error @@ -0,0 +1,7 @@ +error: Invalid attribute for define-class + --> test:4:0 + | + 4 | (repr :enum) + | ^^^^^^^^^^^^ define-class cannot have attributes + 5 | (define-class (C :a)) + | ------ while parsing define-class diff --git a/tests/parser/define-class.19.bad.error b/tests/parser/define-class.19.bad.error new file mode 100644 index 000000000..367f5f100 --- /dev/null +++ b/tests/parser/define-class.19.bad.error @@ -0,0 +1,5 @@ +error: Malformed class definition + --> test:4:31 + | + 4 | (define-class (Eq :a => (C :a) :b)) + | ^^ unexpected form diff --git a/tests/parser/define-class.2.bad.error b/tests/parser/define-class.2.bad.error new file mode 100644 index 000000000..e79d402a9 --- /dev/null +++ b/tests/parser/define-class.2.bad.error @@ -0,0 +1,8 @@ +error: Malformed class definition + --> test:4:15 + | + 4 | (define-class (=> C :a :b)) + | ^^ unnecessary `=>` +help: remove `=>` + 4 | (define-class (C :a :b)) + | --------- diff --git a/tests/parser/define-class.20.bad.error b/tests/parser/define-class.20.bad.error new file mode 100644 index 000000000..b33ee12d7 --- /dev/null +++ b/tests/parser/define-class.20.bad.error @@ -0,0 +1,5 @@ +error: Invalid variable + --> test:5:3 + | + 5 | (.m (:a -> :a))) + | ^^ variables cannot start with '.' diff --git a/tests/parser/define-class.3.bad.error b/tests/parser/define-class.3.bad.error new file mode 100644 index 000000000..d12b4a9c1 --- /dev/null +++ b/tests/parser/define-class.3.bad.error @@ -0,0 +1,7 @@ +error: Malformed method definition + --> test:5:2 + | + 4 | (define-class (C :a :b) + | --------- in this class definition + 5 | m) + | ^ missing method type diff --git a/tests/parser/define-class.4.bad.error b/tests/parser/define-class.4.bad.error new file mode 100644 index 000000000..ed84507dc --- /dev/null +++ b/tests/parser/define-class.4.bad.error @@ -0,0 +1,7 @@ +error: Malformed method definition + --> test:5:7 + | + 4 | (define-class (C :a) + | ------ in this class definition + 5 | (m :a :b)) + | ^^ unexpected trailing form diff --git a/tests/parser/define-class.5.bad.error b/tests/parser/define-class.5.bad.error new file mode 100644 index 000000000..49f520455 --- /dev/null +++ b/tests/parser/define-class.5.bad.error @@ -0,0 +1,5 @@ +error: Malformed class definition + --> test:4:14 + | + 4 | (define-class (C :a :b =>)) + | ^^^^^^^^^^^^ missing class name diff --git a/tests/parser/define-class.6.bad.error b/tests/parser/define-class.6.bad.error new file mode 100644 index 000000000..fee3e6bfc --- /dev/null +++ b/tests/parser/define-class.6.bad.error @@ -0,0 +1,8 @@ +error: Malformed class definition + --> test:4:14 + | + 4 | (define-class C) + | ^ expected class type variable(s) +help: add class type variable `:a` + 4 | (define-class (C :a)) + | ------ diff --git a/tests/parser/define-class.7.bad.error b/tests/parser/define-class.7.bad.error new file mode 100644 index 000000000..51ea6fd09 --- /dev/null +++ b/tests/parser/define-class.7.bad.error @@ -0,0 +1,5 @@ +error: Malformed class definition + --> test:4:0 + | + 4 | (define-class) + | ^^^^^^^^^^^^^^ expected body diff --git a/tests/parser/define-class.8.bad.error b/tests/parser/define-class.8.bad.error new file mode 100644 index 000000000..372468163 --- /dev/null +++ b/tests/parser/define-class.8.bad.error @@ -0,0 +1,8 @@ +error: Malformed class definition + --> test:4:15 + | + 4 | (define-class (=> C)) + | ^^ unnecessary `=>` +help: remove `=>` + 4 | (define-class C) + | - diff --git a/tests/parser/define-class.9.bad.error b/tests/parser/define-class.9.bad.error new file mode 100644 index 000000000..c3141ede2 --- /dev/null +++ b/tests/parser/define-class.9.bad.error @@ -0,0 +1,5 @@ +error: Malformed class definition + --> test:4:15 + | + 4 | (define-class (=>)) + | ^^ unnecessary `=>` diff --git a/tests/parser/define-instance.1.bad.error b/tests/parser/define-instance.1.bad.error new file mode 100644 index 000000000..f63597566 --- /dev/null +++ b/tests/parser/define-instance.1.bad.error @@ -0,0 +1,7 @@ +error: Malformed method definition + --> test:5:2 + | + 4 | (define-instance (C :a) + | ------ when parsing instance + 5 | 5) + | ^ expected list diff --git a/tests/parser/define-instance.10.bad.error b/tests/parser/define-instance.10.bad.error new file mode 100644 index 000000000..c9fb9133f --- /dev/null +++ b/tests/parser/define-instance.10.bad.error @@ -0,0 +1,7 @@ +error: Invalid attribute for define-instance + --> test:4:0 + | + 4 | (repr :enum) + | ^^^^^^^^^^^^ define-instance cannot have attributes + 5 | (define-instance (C :a)) + | ------ while parsing define-instance diff --git a/tests/parser/define-instance.11.bad.error b/tests/parser/define-instance.11.bad.error new file mode 100644 index 000000000..fcf778059 --- /dev/null +++ b/tests/parser/define-instance.11.bad.error @@ -0,0 +1,5 @@ +error: Malformed instance definition + --> test:4:40 + | + 4 | (define-instance (C :a => (C (List :a)) :b)) + | ^^ unexpected form diff --git a/tests/parser/define-instance.2.bad.error b/tests/parser/define-instance.2.bad.error new file mode 100644 index 000000000..2ddad6318 --- /dev/null +++ b/tests/parser/define-instance.2.bad.error @@ -0,0 +1,7 @@ +error: Malformed method definition + --> test:5:2 + | + 4 | (define-instance (C :a) + | ------ when parsing instance + 5 | (1 2 . 3)) + | ^^^^^^^^^ unexpected dotted list diff --git a/tests/parser/define-instance.3.bad.error b/tests/parser/define-instance.3.bad.error new file mode 100644 index 000000000..960ff6369 --- /dev/null +++ b/tests/parser/define-instance.3.bad.error @@ -0,0 +1,7 @@ +error: Malformed method definition + --> test:5:3 + | + 4 | (define-instance (C :a) + | ------ when parsing instance + 5 | (f x y)) + | ^ expected method definition diff --git a/tests/parser/define-instance.4.bad.error b/tests/parser/define-instance.4.bad.error new file mode 100644 index 000000000..abcd3e10a --- /dev/null +++ b/tests/parser/define-instance.4.bad.error @@ -0,0 +1,7 @@ +error: Malformed method definition + --> test:5:2 + | + 4 | (define-instance (C :a) + | ------ when parsing instance + 5 | (define)) + | ^^^^^^^^ expected definition name diff --git a/tests/parser/define-instance.5.bad.error b/tests/parser/define-instance.5.bad.error new file mode 100644 index 000000000..ec3547e4a --- /dev/null +++ b/tests/parser/define-instance.5.bad.error @@ -0,0 +1,5 @@ +error: Malformed instance definition + --> test:4:17 + | + 4 | (define-instance (C :a . :b)) + | ^^^^^^^^^^^ unexpected dotted list diff --git a/tests/parser/define-instance.6.bad.error b/tests/parser/define-instance.6.bad.error new file mode 100644 index 000000000..29343f503 --- /dev/null +++ b/tests/parser/define-instance.6.bad.error @@ -0,0 +1,5 @@ +error: Malformed instance definition + --> test:4:17 + | + 4 | (define-instance 5) + | ^ expected a list diff --git a/tests/parser/define-instance.7.bad._error b/tests/parser/define-instance.7.bad._error new file mode 100644 index 000000000..2c90a44fc --- /dev/null +++ b/tests/parser/define-instance.7.bad._error @@ -0,0 +1,5 @@ +error: Malformed instance definition + --> test:4:17 + | + 4 | (define-instance) + | ^ expected an instance head diff --git a/tests/parser/define-instance.8.bad.error b/tests/parser/define-instance.8.bad.error new file mode 100644 index 000000000..5e38523e6 --- /dev/null +++ b/tests/parser/define-instance.8.bad.error @@ -0,0 +1,8 @@ +error: Malformed instance head + --> test:4:18 + | + 4 | (define-instance (=> C :a :b)) + | ^^ unexpected `=>` +help: remove the `=>` + 4 | (define-instance ( C :a :b)) + | diff --git a/tests/parser/define-instance.9.bad.error b/tests/parser/define-instance.9.bad.error new file mode 100644 index 000000000..149623fbd --- /dev/null +++ b/tests/parser/define-instance.9.bad.error @@ -0,0 +1,8 @@ +error: Malformed instance head + --> test:4:26 + | + 4 | (define-instance (C :a :b =>)) + | ^^ unexpected `=>` +help: remove the `=>` + 4 | (define-instance (C :a :b )) + | diff --git a/tests/parser/define-type.1.bad.error b/tests/parser/define-type.1.bad.error new file mode 100644 index 000000000..1597e82eb --- /dev/null +++ b/tests/parser/define-type.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed type definition + --> test:4:0 + | + 4 | (define-type) + | ^^^^^^^^^^^^^ expected body diff --git a/tests/parser/define-type.10.bad.error b/tests/parser/define-type.10.bad.error new file mode 100644 index 000000000..5a605688c --- /dev/null +++ b/tests/parser/define-type.10.bad.error @@ -0,0 +1,9 @@ +error: Duplicate repr atttribute + --> test:5:0 + | + 4 | (repr :enum) + | ------------ previous attribute here + 5 | (repr :enum) + | ^^^^^^^^^^^^ repr attribute here + 6 | (define-type T) + | - when parsing define-type diff --git a/tests/parser/define-type.11.bad.error b/tests/parser/define-type.11.bad.error new file mode 100644 index 000000000..59b86d511 --- /dev/null +++ b/tests/parser/define-type.11.bad.error @@ -0,0 +1,7 @@ +error: Invalid target for monomorphize attribute + --> test:4:0 + | + 4 | (monomorphize) + | ^^^^^^^^^^^^^^ monomorphize must be attached to a define or declare form + 5 | (define-type T) + | - when parsing define-type diff --git a/tests/parser/define-type.2.bad._error b/tests/parser/define-type.2.bad._error new file mode 100644 index 000000000..712f82fea --- /dev/null +++ b/tests/parser/define-type.2.bad._error @@ -0,0 +1,8 @@ +error: Invalid type variable + --> test:4:16 + | + 4 | (define-type (T a)) + | ^ expected keyword symbol +help: add `:` to symbol + 4 | (define-type (T :a)) + | -- diff --git a/tests/parser/define-type.3.bad.error b/tests/parser/define-type.3.bad.error new file mode 100644 index 000000000..0e1f02ac1 --- /dev/null +++ b/tests/parser/define-type.3.bad.error @@ -0,0 +1,8 @@ +error: Malformed type definition + --> test:4:13 + | + 4 | (define-type (T)) + | ^^^ nullary types should not have parentheses +help: remove unnecessary parentheses + 4 | (define-type T) + | - diff --git a/tests/parser/define-type.4.bad.error b/tests/parser/define-type.4.bad.error new file mode 100644 index 000000000..98257d473 --- /dev/null +++ b/tests/parser/define-type.4.bad.error @@ -0,0 +1,7 @@ +error: Malformed constructor + --> test:5:3 + | + 4 | (define-type (T :a) + | ------ in this type definition + 5 | ((T) :a)) + | ^^^ expected symbol diff --git a/tests/parser/define-type.5.bad.error b/tests/parser/define-type.5.bad.error new file mode 100644 index 000000000..db402b19c --- /dev/null +++ b/tests/parser/define-type.5.bad.error @@ -0,0 +1,5 @@ +error: Malformed type definition + --> test:4:13 + | + 4 | (define-type "T") + | ^^^ expected symbol diff --git a/tests/parser/define-type.6.bad.error b/tests/parser/define-type.6.bad.error new file mode 100644 index 000000000..33c347c0b --- /dev/null +++ b/tests/parser/define-type.6.bad.error @@ -0,0 +1,8 @@ +error: Malformed type definition + --> test:4:14 + | + 4 | (define-type ((T) :a)) + | ^^^ expected symbol +help: remove parentheses + 4 | (define-type (T) :a) + | ------ diff --git a/tests/parser/define-type.7.bad.error b/tests/parser/define-type.7.bad.error new file mode 100644 index 000000000..cbed1eb46 --- /dev/null +++ b/tests/parser/define-type.7.bad.error @@ -0,0 +1,5 @@ +error: Malformed type definition + --> test:4:14 + | + 4 | (define-type ("T" :a :b)) + | ^^^ expected symbol diff --git a/tests/parser/define-type.8.bad.error b/tests/parser/define-type.8.bad.error new file mode 100644 index 000000000..3bd0a7267 --- /dev/null +++ b/tests/parser/define-type.8.bad.error @@ -0,0 +1,5 @@ +error: Invalid type variable + --> test:4:16 + | + 4 | (define-type (T (:a))) + | ^^^^ expected keyword symbol diff --git a/tests/parser/define-type.9.bad.error b/tests/parser/define-type.9.bad.error new file mode 100644 index 000000000..e57cb770c --- /dev/null +++ b/tests/parser/define-type.9.bad.error @@ -0,0 +1,7 @@ +error: Malformed constructor + --> test:5:2 + | + 4 | (define-type (T :a) + | ------ in this type definition + 5 | 0.5) + | ^^^ expected symbol diff --git a/tests/parser/define.1.bad.error b/tests/parser/define.1.bad.error new file mode 100644 index 000000000..59ce7d103 --- /dev/null +++ b/tests/parser/define.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed definition + --> test:4:0 + | + 4 | (define) + | ^^^^^^^^ expected define body diff --git a/tests/parser/define.2.bad.error b/tests/parser/define.2.bad.error new file mode 100644 index 000000000..da6c7bd75 --- /dev/null +++ b/tests/parser/define.2.bad.error @@ -0,0 +1,5 @@ +error: Invalid variable + --> test:4:8 + | + 4 | (define "x" 1.5) + | ^^^ expected identifier diff --git a/tests/parser/define.3.bad.error b/tests/parser/define.3.bad.error new file mode 100644 index 000000000..a53efbc90 --- /dev/null +++ b/tests/parser/define.3.bad.error @@ -0,0 +1,9 @@ +error: Duplicate monomorphize attribute + --> test:5:0 + | + 4 | (monomorphize) + | -------------- previous attribute here + 5 | (monomorphize) + | ^^^^^^^^^^^^^^ monomorphize attribute here + 6 | (define f x) + | - when parsing define diff --git a/tests/parser/define.4.bad.error b/tests/parser/define.4.bad.error new file mode 100644 index 000000000..39b7d4122 --- /dev/null +++ b/tests/parser/define.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed definition + --> test:4:0 + | + 4 | (define x) + | ^^^^^^^^^^ expected value diff --git a/tests/parser/define.5.bad.error b/tests/parser/define.5.bad.error new file mode 100644 index 000000000..37a7ce052 --- /dev/null +++ b/tests/parser/define.5.bad.error @@ -0,0 +1,5 @@ +error: Malformed function definition + --> test:4:9 + | + 4 | (define (0.5 x y) 2) + | ^^^ expected symbol diff --git a/tests/parser/define.6.bad.error b/tests/parser/define.6.bad.error new file mode 100644 index 000000000..e4923771c --- /dev/null +++ b/tests/parser/define.6.bad.error @@ -0,0 +1,5 @@ +error: Invalid pattern + --> test:4:12 + | + 4 | (define (f (0.5) x) 1) + | ^^^ invalid constructor in pattern diff --git a/tests/parser/define.7.bad.error b/tests/parser/define.7.bad.error new file mode 100644 index 000000000..75dc86c51 --- /dev/null +++ b/tests/parser/define.7.bad.error @@ -0,0 +1,7 @@ +error: Invalid target for repr attribute + --> test:4:0 + | + 4 | (repr :enum) + | ^^^^^^^^^^^^ repr must be attached to a define-type + 5 | (define f x) + | - when parsing define diff --git a/tests/parser/package.1.bad.error b/tests/parser/package.1.bad.error new file mode 100644 index 000000000..7573475f8 --- /dev/null +++ b/tests/parser/package.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed package declaration + --> test:2:1 + | + 2 | (package) + | ^^^^^^^ missing package name diff --git a/tests/parser/package.2.bad.error b/tests/parser/package.2.bad.error new file mode 100644 index 000000000..6ad870d37 --- /dev/null +++ b/tests/parser/package.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed package declaration + --> test:2:9 + | + 2 | (package 5) + | ^ package name must be a symbol diff --git a/tests/parser/package.3.bad.error b/tests/parser/package.3.bad.error new file mode 100644 index 000000000..1b955bf1b --- /dev/null +++ b/tests/parser/package.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed package declaration + --> test:2:1 + | + 2 | (pancake test) + | ^^^^^^^ package declarations must start with `package` diff --git a/tests/parser/package.4.bad.error b/tests/parser/package.4.bad.error new file mode 100644 index 000000000..de2e084a9 --- /dev/null +++ b/tests/parser/package.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed package declaration + --> test:2:22 + | + 2 | (package test-package 1) + | ^ unexpected forms diff --git a/tests/parser/parse-and.1.bad.error b/tests/parser/parse-and.1.bad.error new file mode 100644 index 000000000..0fca86690 --- /dev/null +++ b/tests/parser/parse-and.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed and expression + --> test:4:15 + | + 4 | (define x (and)) + | ^ expected one or more arguments diff --git a/tests/parser/parse-attribute.1.bad.error b/tests/parser/parse-attribute.1.bad.error new file mode 100644 index 000000000..7ce00bc24 --- /dev/null +++ b/tests/parser/parse-attribute.1.bad.error @@ -0,0 +1,5 @@ +error: Orphan attribute + --> test:4:0 + | + 4 | (repr :enum) + | ^^^^^^^^^^^^ attribute must be attached to another form diff --git a/tests/parser/parse-attribute.2.bad.error b/tests/parser/parse-attribute.2.bad.error new file mode 100644 index 000000000..bb425a1fc --- /dev/null +++ b/tests/parser/parse-attribute.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed monomophize attribute + --> test:4:0 + | + 4 | (monomorphize 5) + | ^^^^^^^^^^^^^^^^ unexpected form diff --git a/tests/parser/parse-attribute.3.bad.error b/tests/parser/parse-attribute.3.bad.error new file mode 100644 index 000000000..a02dce4ef --- /dev/null +++ b/tests/parser/parse-attribute.3.bad.error @@ -0,0 +1,5 @@ +error: Invalid type variable + --> test:4:6 + | + 4 | (repr (:enum)) + | ^^^^^^^ expected keyword symbol diff --git a/tests/parser/parse-attribute.4.bad.error b/tests/parser/parse-attribute.4.bad.error new file mode 100644 index 000000000..122aa1749 --- /dev/null +++ b/tests/parser/parse-attribute.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed repr attribute + --> test:4:12 + | + 4 | (repr :enum 5) + | ^ unexpected form diff --git a/tests/parser/parse-attribute.5.bad._error b/tests/parser/parse-attribute.5.bad._error new file mode 100644 index 000000000..5301a59d1 --- /dev/null +++ b/tests/parser/parse-attribute.5.bad._error @@ -0,0 +1,5 @@ +error: Malformed repr :native attribute + --> test:4:14 + | + 4 | (repr :native) + | ^ expected a lisp type diff --git a/tests/parser/parse-attribute.6.bad.error b/tests/parser/parse-attribute.6.bad.error new file mode 100644 index 000000000..fc60d20ed --- /dev/null +++ b/tests/parser/parse-attribute.6.bad.error @@ -0,0 +1,5 @@ +error: Malformed repr :native attribute + --> test:4:6 + | + 4 | (repr :native :native :native) + | ^^^^^^^ unexpected form diff --git a/tests/parser/parse-attribute.7.bad.error b/tests/parser/parse-attribute.7.bad.error new file mode 100644 index 000000000..196615a49 --- /dev/null +++ b/tests/parser/parse-attribute.7.bad.error @@ -0,0 +1,5 @@ +error: Unknown repr attribute + --> test:4:6 + | + 4 | (repr :hello) + | ^^^^^^ expected one of :lisp, :transparent, :enum, or :native diff --git a/tests/parser/parse-body.1.bad.error b/tests/parser/parse-body.1.bad.error new file mode 100644 index 000000000..d7fbada1b --- /dev/null +++ b/tests/parser/parse-body.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed function + --> test:4:17 + | + 4 | (define x (progn)) + | ^ expected body diff --git a/tests/parser/parse-body.2.bad.error b/tests/parser/parse-body.2.bad.error new file mode 100644 index 000000000..6e51066fa --- /dev/null +++ b/tests/parser/parse-body.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed expression + --> test:4:10 + | + 4 | (define x (progn 1 2 . 3)) + | ^^^^^^^^^^^^^^^ unexpected dotted list diff --git a/tests/parser/parse-body.3.bad.error b/tests/parser/parse-body.3.bad.error new file mode 100644 index 000000000..2bc67686e --- /dev/null +++ b/tests/parser/parse-body.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed body expression + --> test:6:4 + | + 6 | (let x = 5 . 5) + | ^^^^^^^^^^^^^^^ unexpected dotted list diff --git a/tests/parser/parse-body.4.bad.error b/tests/parser/parse-body.4.bad.error new file mode 100644 index 000000000..bf637cf9a --- /dev/null +++ b/tests/parser/parse-body.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed body expression + --> test:6:4 + | + 6 | (let x = 5))) + | ^^^^^^^^^^^ body forms cannot be terminated by a shorthand let diff --git a/tests/parser/parse-body.5.bad.error b/tests/parser/parse-body.5.bad.error new file mode 100644 index 000000000..15baf7ced --- /dev/null +++ b/tests/parser/parse-body.5.bad.error @@ -0,0 +1,5 @@ +error: Malformed shorthand let + --> test:6:15 + | + 6 | (let x = 1 2) + | ^ unexpected trailing form diff --git a/tests/parser/parse-break.1.bad.error b/tests/parser/parse-break.1.bad.error new file mode 100644 index 000000000..4d6e432be --- /dev/null +++ b/tests/parser/parse-break.1.bad.error @@ -0,0 +1,5 @@ +error: Invalid break + --> test:4:10 + | + 4 | (define f (break)) + | ^^^^^^^ break does not appear in an enclosing loop diff --git a/tests/parser/parse-break.2.bad.error b/tests/parser/parse-break.2.bad.error new file mode 100644 index 000000000..b42fdb65d --- /dev/null +++ b/tests/parser/parse-break.2.bad.error @@ -0,0 +1,5 @@ +error: Invalid label in break + --> test:5:24 + | + 5 | (while :x True (break :y))) + | ^^ label not found in any enclosing loop diff --git a/tests/parser/parse-break.3.bad.error b/tests/parser/parse-break.3.bad.error new file mode 100644 index 000000000..c22e47211 --- /dev/null +++ b/tests/parser/parse-break.3.bad.error @@ -0,0 +1,5 @@ +error: Invalid label in break + --> test:5:39 + | + 5 | (while :x True (return (fn () (break :x))))) + | ^^ label not found in any enclosing loop diff --git a/tests/parser/parse-break.4.bad.error b/tests/parser/parse-break.4.bad.error new file mode 100644 index 000000000..4cf934125 --- /dev/null +++ b/tests/parser/parse-break.4.bad.error @@ -0,0 +1,5 @@ +error: Invalid break + --> test:5:29 + | + 5 | (while True (return (fn () (break))))) + | ^^^^^^^ break does not appear in an enclosing loop diff --git a/tests/parser/parse-cond.1.bad.error b/tests/parser/parse-cond.1.bad.error new file mode 100644 index 000000000..18358d46f --- /dev/null +++ b/tests/parser/parse-cond.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed cond expression + --> test:4:16 + | + 4 | (define x (cond)) + | ^ expected one or more clauses diff --git a/tests/parser/parse-cond.2.bad.error b/tests/parser/parse-cond.2.bad.error new file mode 100644 index 000000000..fc69770ff --- /dev/null +++ b/tests/parser/parse-cond.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed cond clause + --> test:4:16 + | + 4 | (define x (cond 1)) + | ^ expected list diff --git a/tests/parser/parse-cond.3.bad.error b/tests/parser/parse-cond.3.bad.error new file mode 100644 index 000000000..522a6fad7 --- /dev/null +++ b/tests/parser/parse-cond.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed cond clause + --> test:4:16 + | + 4 | (define x (cond (1 2 . 3))) + | ^^^^^^^^^ unexpected dotted list diff --git a/tests/parser/parse-cond.4.bad.error b/tests/parser/parse-cond.4.bad.error new file mode 100644 index 000000000..56b43e41e --- /dev/null +++ b/tests/parser/parse-cond.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed function + --> test:4:19 + | + 4 | (define x (cond (y))) + | ^ expected body diff --git a/tests/parser/parse-continue.1.bad.error b/tests/parser/parse-continue.1.bad.error new file mode 100644 index 000000000..c4951ebba --- /dev/null +++ b/tests/parser/parse-continue.1.bad.error @@ -0,0 +1,5 @@ +error: Invalid continue + --> test:4:10 + | + 4 | (define f (continue)) + | ^^^^^^^^^^ continue does not appear in an enclosing loop diff --git a/tests/parser/parse-continue.2.bad.error b/tests/parser/parse-continue.2.bad.error new file mode 100644 index 000000000..a16d44f77 --- /dev/null +++ b/tests/parser/parse-continue.2.bad.error @@ -0,0 +1,5 @@ +error: Invalid argument in continue + --> test:6:4 + | + 6 | (continue notakeyword))) + | ^^^^^^^^^^^^^^^^^^^^^^ expected a keyword diff --git a/tests/parser/parse-continue.3.bad.error b/tests/parser/parse-continue.3.bad.error new file mode 100644 index 000000000..1cdcd0038 --- /dev/null +++ b/tests/parser/parse-continue.3.bad.error @@ -0,0 +1,5 @@ +error: Invalid label in continue + --> test:6:14 + | + 6 | (continue :not-foo))) + | ^^^^^^^^ label not found in any enclosing loop diff --git a/tests/parser/parse-continue.4.bad.error b/tests/parser/parse-continue.4.bad.error new file mode 100644 index 000000000..f8b54027c --- /dev/null +++ b/tests/parser/parse-continue.4.bad.error @@ -0,0 +1,5 @@ +error: Invalid continue + --> test:6:28 + | + 6 | (let ((continuer (fn () (continue)))) + | ^^^^^^^^^^ continue does not appear in an enclosing loop diff --git a/tests/parser/parse-continue.5.bad.error b/tests/parser/parse-continue.5.bad.error new file mode 100644 index 000000000..4d88669f7 --- /dev/null +++ b/tests/parser/parse-continue.5.bad.error @@ -0,0 +1,5 @@ +error: Invalid label in continue + --> test:6:42 + | + 6 | (let ((continuer (fn () (continue :blech)))) + | ^^^^^^ label not found in any enclosing loop diff --git a/tests/parser/parse-declare.1.bad.error b/tests/parser/parse-declare.1.bad.error new file mode 100644 index 000000000..3db003698 --- /dev/null +++ b/tests/parser/parse-declare.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed declaration + --> test:4:0 + | + 4 | (declare) + | ^^^^^^^^^ expected body diff --git a/tests/parser/parse-declare.2.bad.error b/tests/parser/parse-declare.2.bad.error new file mode 100644 index 000000000..b8f871f8f --- /dev/null +++ b/tests/parser/parse-declare.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed declaration + --> test:4:0 + | + 4 | (declare x) + | ^^^^^^^^^^^ expected declared type diff --git a/tests/parser/parse-declare.3.bad.error b/tests/parser/parse-declare.3.bad.error new file mode 100644 index 000000000..2223b8ec7 --- /dev/null +++ b/tests/parser/parse-declare.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed declaration + --> test:4:20 + | + 4 | (declare x (T -> T) z) + | ^ unexpected trailing form diff --git a/tests/parser/parse-declare.4.bad.error b/tests/parser/parse-declare.4.bad.error new file mode 100644 index 000000000..640e2bcd3 --- /dev/null +++ b/tests/parser/parse-declare.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed declaration + --> test:4:9 + | + 4 | (declare "x" 5) + | ^^^ expected symbol diff --git a/tests/parser/parse-declare.5.bad.error b/tests/parser/parse-declare.5.bad.error new file mode 100644 index 000000000..5ad0ac517 --- /dev/null +++ b/tests/parser/parse-declare.5.bad.error @@ -0,0 +1,7 @@ +error: Invalid target for repr attribute + --> test:4:0 + | + 4 | (repr :enum) + | ^^^^^^^^^^^^ repr must be attached to a define-type + 5 | (declare x T) + | ------------- when parsing declare diff --git a/tests/parser/parse-declare.6.bad.error b/tests/parser/parse-declare.6.bad.error new file mode 100644 index 000000000..a1366fc1d --- /dev/null +++ b/tests/parser/parse-declare.6.bad.error @@ -0,0 +1,9 @@ +error: Duplicate monomorphize attribute + --> test:5:0 + | + 4 | (monomorphize) + | -------------- previous attribute here + 5 | (monomorphize) + | ^^^^^^^^^^^^^^ monomorphize attribute here + 6 | (declare f T) + | ------------- when parsing declare diff --git a/tests/parser/parse-do.1.bad.error b/tests/parser/parse-do.1.bad.error new file mode 100644 index 000000000..533b30ef4 --- /dev/null +++ b/tests/parser/parse-do.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed bind form + --> test:6:13 + | + 6 | (x <- mx y) + | ^ unexpected trailing form diff --git a/tests/parser/parse-do.2.bad.error b/tests/parser/parse-do.2.bad.error new file mode 100644 index 000000000..7814f9a5f --- /dev/null +++ b/tests/parser/parse-do.2.bad.error @@ -0,0 +1,6 @@ +error: Malformed do expression + --> test:5:6 + | + 5 | (do (x <- mx))) + | -- when parsing do expression + | ^^^^^^^^^ do expression cannot be terminated by a bind diff --git a/tests/parser/parse-do.3.bad.error b/tests/parser/parse-do.3.bad.error new file mode 100644 index 000000000..546bd8da4 --- /dev/null +++ b/tests/parser/parse-do.3.bad.error @@ -0,0 +1,6 @@ +error: Malformed do expression + --> test:5:6 + | + 5 | (do (let x = 5))) + | -- when parsing do expression + | ^^^^^^^^^^^ do expressions cannot be terminated by a shorthand let diff --git a/tests/parser/parse-do.4.bad.error b/tests/parser/parse-do.4.bad.error new file mode 100644 index 000000000..091a8ad38 --- /dev/null +++ b/tests/parser/parse-do.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed do expression + --> test:4:14 + | + 4 | (define x (do)) + | ^ expected one or more forms diff --git a/tests/parser/parse-expression.1.bad.error b/tests/parser/parse-expression.1.bad.error new file mode 100644 index 000000000..4911fb66f --- /dev/null +++ b/tests/parser/parse-expression.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed expression + --> test:4:10 + | + 4 | (define x ()) + | ^^ unexpected `nil` or `()` diff --git a/tests/parser/parse-expression.2.bad.error b/tests/parser/parse-expression.2.bad.error new file mode 100644 index 000000000..38a68158a --- /dev/null +++ b/tests/parser/parse-expression.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed expression + --> test:4:10 + | + 4 | (define x (f . x)) + | ^^^^^^^ unexpected dotted list diff --git a/tests/parser/parse-expression.3.bad.error b/tests/parser/parse-expression.3.bad.error new file mode 100644 index 000000000..c1849c829 --- /dev/null +++ b/tests/parser/parse-expression.3.bad.error @@ -0,0 +1,5 @@ +error: Invalid literal + --> test:4:10 + | + 4 | (define x #C(1 2)) + | ^^^^^^^ unknown literal type diff --git a/tests/parser/parse-expression.4.bad.error b/tests/parser/parse-expression.4.bad.error new file mode 100644 index 000000000..49a341089 --- /dev/null +++ b/tests/parser/parse-expression.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed expression + --> test:4:10 + | + 4 | (define x (f . 3)) + | ^^^^^^^ unexpected dotted list diff --git a/tests/parser/parse-fn.1.bad.error b/tests/parser/parse-fn.1.bad.error new file mode 100644 index 000000000..de88a1fe7 --- /dev/null +++ b/tests/parser/parse-fn.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed function + --> test:4:14 + | + 4 | (define f (fn)) + | ^ expected function arguments diff --git a/tests/parser/parse-fn.2.bad.error b/tests/parser/parse-fn.2.bad.error new file mode 100644 index 000000000..69d1389a0 --- /dev/null +++ b/tests/parser/parse-fn.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed function + --> test:4:17 + | + 4 | (define f (fn ())) + | ^ expected function body diff --git a/tests/parser/parse-fn.3.bad.error b/tests/parser/parse-fn.3.bad.error new file mode 100644 index 000000000..4b0632964 --- /dev/null +++ b/tests/parser/parse-fn.3.bad.error @@ -0,0 +1,8 @@ +error: Malformed function + --> test:4:14 + | + 4 | (define f (fn x 1)) + | ^ malformed arugment list +help: add parentheses + 4 | (define f (fn (x) 1)) + | --- diff --git a/tests/parser/parse-for.1.bad.error b/tests/parser/parse-for.1.bad.error new file mode 100644 index 000000000..f933e3b9c --- /dev/null +++ b/tests/parser/parse-for.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed for expression + --> test:4:15 + | + 4 | (define f (for)) + | ^ expected pattern diff --git a/tests/parser/parse-for.2.bad.error b/tests/parser/parse-for.2.bad.error new file mode 100644 index 000000000..8587437e3 --- /dev/null +++ b/tests/parser/parse-for.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed for expression + --> test:4:17 + | + 4 | (define f (for x)) + | ^ expected in diff --git a/tests/parser/parse-for.3.bad.error b/tests/parser/parse-for.3.bad.error new file mode 100644 index 000000000..3ea95cbc8 --- /dev/null +++ b/tests/parser/parse-for.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed for expression + --> test:4:19 + | + 4 | (define f (for x y)) + | ^ expected in diff --git a/tests/parser/parse-for.4.bad.error b/tests/parser/parse-for.4.bad.error new file mode 100644 index 000000000..4f74c200b --- /dev/null +++ b/tests/parser/parse-for.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed for expression + --> test:4:25 + | + 4 | (define f (for x in iter)) + | ^ expected body diff --git a/tests/parser/parse-for.5.bad.error b/tests/parser/parse-for.5.bad.error new file mode 100644 index 000000000..4874d0fae --- /dev/null +++ b/tests/parser/parse-for.5.bad.error @@ -0,0 +1,5 @@ +error: Malformed for expression + --> test:4:32 + | + 4 | (define f (for :label x in iter)) + | ^ expected body diff --git a/tests/parser/parse-if.1.bad.error b/tests/parser/parse-if.1.bad.error new file mode 100644 index 000000000..30716e35f --- /dev/null +++ b/tests/parser/parse-if.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed if expression + --> test:4:14 + | + 4 | (define x (if)) + | ^ expected a predicate diff --git a/tests/parser/parse-if.2.bad.error b/tests/parser/parse-if.2.bad.error new file mode 100644 index 000000000..c6373852a --- /dev/null +++ b/tests/parser/parse-if.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed if expression + --> test:4:16 + | + 4 | (define x (if 1)) + | ^ expected a form diff --git a/tests/parser/parse-if.3.bad.error b/tests/parser/parse-if.3.bad.error new file mode 100644 index 000000000..502ebdc3e --- /dev/null +++ b/tests/parser/parse-if.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed if expression + --> test:4:18 + | + 4 | (define x (if 1 2)) + | ^ expected a form diff --git a/tests/parser/parse-if.4.bad.error b/tests/parser/parse-if.4.bad.error new file mode 100644 index 000000000..f99330f10 --- /dev/null +++ b/tests/parser/parse-if.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed if expression + --> test:4:21 + | + 4 | (define x (if 1 2 3 4)) + | ^ unexpected trailing form diff --git a/tests/parser/parse-let.1.bad.error b/tests/parser/parse-let.1.bad.error new file mode 100644 index 000000000..041fc68cd --- /dev/null +++ b/tests/parser/parse-let.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed let + --> test:4:15 + | + 4 | (define f (let)) + | ^ expected let binding list diff --git a/tests/parser/parse-let.2.bad.error b/tests/parser/parse-let.2.bad.error new file mode 100644 index 000000000..7abe7f95c --- /dev/null +++ b/tests/parser/parse-let.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed let + --> test:4:18 + | + 4 | (define f (let ())) + | ^ expected let body diff --git a/tests/parser/parse-let.3.bad.error b/tests/parser/parse-let.3.bad.error new file mode 100644 index 000000000..261ad5992 --- /dev/null +++ b/tests/parser/parse-let.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed let + --> test:4:15 + | + 4 | (define f (let x 5)) + | ^ expected binding list diff --git a/tests/parser/parse-let.4.bad.error b/tests/parser/parse-let.4.bad.error new file mode 100644 index 000000000..ead89f916 --- /dev/null +++ b/tests/parser/parse-let.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed let binding + --> test:5:8 + | + 5 | (let ((y 2 . 3)) + | ^^^^^^^^^ unexpected dotted list diff --git a/tests/parser/parse-let.5.bad.error b/tests/parser/parse-let.5.bad.error new file mode 100644 index 000000000..96f660ee6 --- /dev/null +++ b/tests/parser/parse-let.5.bad.error @@ -0,0 +1,5 @@ +error: Malformed let binding + --> test:5:10 + | + 5 | (let ((x)) 5)) + | ^ let bindings must have a value diff --git a/tests/parser/parse-let.6.bad.error b/tests/parser/parse-let.6.bad.error new file mode 100644 index 000000000..e70b4d7d3 --- /dev/null +++ b/tests/parser/parse-let.6.bad.error @@ -0,0 +1,5 @@ +error: Malformed let binding + --> test:5:8 + | + 5 | (let (x) 5)) + | ^ expected list diff --git a/tests/parser/parse-let.7.bad.error b/tests/parser/parse-let.7.bad.error new file mode 100644 index 000000000..86b6aecb0 --- /dev/null +++ b/tests/parser/parse-let.7.bad.error @@ -0,0 +1,5 @@ +error: Malformed let binding + --> test:5:13 + | + 5 | (let ((x y z)) 5)) + | ^ unexpected trailing form diff --git a/tests/parser/parse-let.8.bad.error b/tests/parser/parse-let.8.bad.error new file mode 100644 index 000000000..7679dcacf --- /dev/null +++ b/tests/parser/parse-let.8.bad.error @@ -0,0 +1,5 @@ +error: Malformed declare + --> test:5:28 + | + 5 | (let ((declare x (T -> T) 5)) + | ^ unexpected form diff --git a/tests/parser/parse-let.9.bad.error b/tests/parser/parse-let.9.bad.error new file mode 100644 index 000000000..cdbc14517 --- /dev/null +++ b/tests/parser/parse-let.9.bad.error @@ -0,0 +1,5 @@ +error: Invalid variable + --> test:5:17 + | + 5 | (let ((declare 5 (T -> T))) + | ^ expected identifier diff --git a/tests/parser/parse-lisp.1.bad.error b/tests/parser/parse-lisp.1.bad.error new file mode 100644 index 000000000..59b6f9fbb --- /dev/null +++ b/tests/parser/parse-lisp.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed lisp expression + --> test:4:16 + | + 4 | (define f (lisp)) + | ^ expected expression type diff --git a/tests/parser/parse-lisp.2.bad.error b/tests/parser/parse-lisp.2.bad.error new file mode 100644 index 000000000..81d8561a3 --- /dev/null +++ b/tests/parser/parse-lisp.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed lisp expression + --> test:4:25 + | + 4 | (define f (lisp (T -> T))) + | ^ expected binding list diff --git a/tests/parser/parse-lisp.3.bad.error b/tests/parser/parse-lisp.3.bad.error new file mode 100644 index 000000000..6878f2a3d --- /dev/null +++ b/tests/parser/parse-lisp.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed lisp expression + --> test:4:10 + | + 4 | (define f (lisp (T -> T) (x y))) + | ^^^^^^^^^^^^^^^^^^^^^ expected body diff --git a/tests/parser/parse-loop.1.bad.error b/tests/parser/parse-loop.1.bad.error new file mode 100644 index 000000000..f322a3e3d --- /dev/null +++ b/tests/parser/parse-loop.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed loop expression + --> test:4:16 + | + 4 | (define f (loop)) + | ^ expected a loop body diff --git a/tests/parser/parse-loop.2.bad.error b/tests/parser/parse-loop.2.bad.error new file mode 100644 index 000000000..e94e4714c --- /dev/null +++ b/tests/parser/parse-loop.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed loop expression + --> test:4:24 + | + 4 | (define f (loop :alabel)) + | ^ expected a loop body diff --git a/tests/parser/parse-match.1.bad.error b/tests/parser/parse-match.1.bad.error new file mode 100644 index 000000000..2af242966 --- /dev/null +++ b/tests/parser/parse-match.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed match expression + --> test:4:17 + | + 4 | (define f (match)) + | ^ expected expression diff --git a/tests/parser/parse-match.2.bad.error b/tests/parser/parse-match.2.bad.error new file mode 100644 index 000000000..5c9e1ed82 --- /dev/null +++ b/tests/parser/parse-match.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed match branch + --> test:6:7 + | + 6 | (y))) + | ^ expected body diff --git a/tests/parser/parse-match.3.bad.error b/tests/parser/parse-match.3.bad.error new file mode 100644 index 000000000..bdf4725e7 --- /dev/null +++ b/tests/parser/parse-match.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed match branch + --> test:6:4 + | + 6 | 5)) + | ^ expected list diff --git a/tests/parser/parse-match.4.bad.error b/tests/parser/parse-match.4.bad.error new file mode 100644 index 000000000..fbab07a41 --- /dev/null +++ b/tests/parser/parse-match.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed match branch + --> test:6:4 + | + 6 | (x y . z))) + | ^^^^^^^^^ unexpected dotted list diff --git a/tests/parser/parse-or.1.bad.error b/tests/parser/parse-or.1.bad.error new file mode 100644 index 000000000..9bd274c05 --- /dev/null +++ b/tests/parser/parse-or.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed or expression + --> test:4:14 + | + 4 | (define x (or)) + | ^ expected one or more arguments diff --git a/tests/parser/parse-pattern.1.bad.error b/tests/parser/parse-pattern.1.bad.error new file mode 100644 index 000000000..1f4d4fbd6 --- /dev/null +++ b/tests/parser/parse-pattern.1.bad.error @@ -0,0 +1,5 @@ +error: Invalid pattern + --> test:5:7 + | + 5 | (let #C(1 2) = x) + | ^^^^^^^ unknown pattern literal diff --git a/tests/parser/parse-pattern.2.bad.error b/tests/parser/parse-pattern.2.bad.error new file mode 100644 index 000000000..d6ec47889 --- /dev/null +++ b/tests/parser/parse-pattern.2.bad.error @@ -0,0 +1,5 @@ +error: Invalid match branch + --> test:5:7 + | + 5 | (let (x y . z) = g) + | ^^^^^^^^^ unexpected dotted list diff --git a/tests/parser/parse-pattern.3.bad.error b/tests/parser/parse-pattern.3.bad.error new file mode 100644 index 000000000..8a09475a5 --- /dev/null +++ b/tests/parser/parse-pattern.3.bad.error @@ -0,0 +1,5 @@ +error: Invalid pattern + --> test:5:8 + | + 5 | (let (5 x y) = g) + | ^ invalid constructor in pattern diff --git a/tests/parser/parse-return.1.bad.error b/tests/parser/parse-return.1.bad.error new file mode 100644 index 000000000..58e9fd5fb --- /dev/null +++ b/tests/parser/parse-return.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed return expression + --> test:4:20 + | + 4 | (define x (return y z)) + | ^ unexpected trailing form diff --git a/tests/parser/parse-the.1.bad.error b/tests/parser/parse-the.1.bad.error new file mode 100644 index 000000000..86e8bd380 --- /dev/null +++ b/tests/parser/parse-the.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed the expression + --> test:4:15 + | + 4 | (define x (the)) + | ^ expected type diff --git a/tests/parser/parse-the.2.bad.error b/tests/parser/parse-the.2.bad.error new file mode 100644 index 000000000..cad0d048e --- /dev/null +++ b/tests/parser/parse-the.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed the expression + --> test:4:24 + | + 4 | (define x (the (T -> T))) + | ^ expected value diff --git a/tests/parser/parse-the.3.bad.error b/tests/parser/parse-the.3.bad.error new file mode 100644 index 000000000..ec93575e2 --- /dev/null +++ b/tests/parser/parse-the.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed the expression + --> test:4:26 + | + 4 | (define x (the (T -> T) y z)) + | ^ unexpected trailing form diff --git a/tests/parser/parse-toplevel.1.bad.error b/tests/parser/parse-toplevel.1.bad.error new file mode 100644 index 000000000..14c6e0a49 --- /dev/null +++ b/tests/parser/parse-toplevel.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed toplevel form + --> test:4:1 + | + 4 | ((define) x 5) + | ^^^^^^^^ unexpected list diff --git a/tests/parser/parse-toplevel.2.bad.error b/tests/parser/parse-toplevel.2.bad.error new file mode 100644 index 000000000..b33564990 --- /dev/null +++ b/tests/parser/parse-toplevel.2.bad.error @@ -0,0 +1,5 @@ +error: Invalid toplevel form + --> test:4:1 + | + 4 | (unknown) + | ^^^^^^^ unknown toplevel form diff --git a/tests/parser/parse-type.1.bad.error b/tests/parser/parse-type.1.bad.error new file mode 100644 index 000000000..3779ec3ea --- /dev/null +++ b/tests/parser/parse-type.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed type + --> test:4:17 + | + 4 | (declare f (T -> (G))) + | ^^^ unexpected nullary type diff --git a/tests/parser/parse-type.10.bad.error b/tests/parser/parse-type.10.bad.error new file mode 100644 index 000000000..e27f4b0cf --- /dev/null +++ b/tests/parser/parse-type.10.bad.error @@ -0,0 +1,5 @@ +error: Malformed type + --> test:4:17 + | + 4 | (declare f (T -> "T")) + | ^^^ expected identifier diff --git a/tests/parser/parse-type.11.bad.error b/tests/parser/parse-type.11.bad.error new file mode 100644 index 000000000..9b6d7ea33 --- /dev/null +++ b/tests/parser/parse-type.11.bad.error @@ -0,0 +1,5 @@ +error: Malformed function type + --> test:4:12 + | + 4 | (declare f (-> T)) + | ^^ invalid function syntax diff --git a/tests/parser/parse-type.12.bad.error b/tests/parser/parse-type.12.bad.error new file mode 100644 index 000000000..702121cbe --- /dev/null +++ b/tests/parser/parse-type.12.bad.error @@ -0,0 +1,5 @@ +error: Malformed function type + --> test:4:14 + | + 4 | (declare f (T ->)) + | ^^ missing return type diff --git a/tests/parser/parse-type.13.bad.error b/tests/parser/parse-type.13.bad.error new file mode 100644 index 000000000..647c3901d --- /dev/null +++ b/tests/parser/parse-type.13.bad.error @@ -0,0 +1,8 @@ +error: Malformed type + --> test:4:12 + | + 4 | (declare f (=> T)) + | ^^ unnecessary `=>` +help: remove `=>` + 4 | (declare f T) + | - diff --git a/tests/parser/parse-type.2.bad.error b/tests/parser/parse-type.2.bad.error new file mode 100644 index 000000000..12b784f8f --- /dev/null +++ b/tests/parser/parse-type.2.bad.error @@ -0,0 +1,8 @@ +error: Malformed type + --> test:4:12 + | + 4 | (declare f (=> T -> T)) + | ^^ unnecessary `=>` +help: remove `=>` + 4 | (declare f (T -> T)) + | -------- diff --git a/tests/parser/parse-type.3.bad.error b/tests/parser/parse-type.3.bad.error new file mode 100644 index 000000000..bf8944cb7 --- /dev/null +++ b/tests/parser/parse-type.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed type + --> test:4:14 + | + 4 | (declare f (T :a =>)) + | ^^ missing type after `=>` diff --git a/tests/parser/parse-type.4.bad.error b/tests/parser/parse-type.4.bad.error new file mode 100644 index 000000000..9880e1170 --- /dev/null +++ b/tests/parser/parse-type.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed type predicate + --> test:4:12 + | + 4 | (declare f (T => T -> T)) + | ^ expected predicate diff --git a/tests/parser/parse-type.5.bad.error b/tests/parser/parse-type.5.bad.error new file mode 100644 index 000000000..f4d6c752c --- /dev/null +++ b/tests/parser/parse-type.5.bad.error @@ -0,0 +1,5 @@ +error: Malformed type predicate + --> test:4:12 + | + 4 | (declare f ("T" :a => T)) + | ^^^ expected identifier diff --git a/tests/parser/parse-type.6.bad.error b/tests/parser/parse-type.6.bad.error new file mode 100644 index 000000000..5906db5b8 --- /dev/null +++ b/tests/parser/parse-type.6.bad.error @@ -0,0 +1,5 @@ +error: Malformed type + --> test:4:12 + | + 4 | (declare f (=>)) + | ^^ unnecessary `=>` diff --git a/tests/parser/parse-type.7.bad.error b/tests/parser/parse-type.7.bad.error new file mode 100644 index 000000000..12b784f8f --- /dev/null +++ b/tests/parser/parse-type.7.bad.error @@ -0,0 +1,8 @@ +error: Malformed type + --> test:4:12 + | + 4 | (declare f (=> T -> T)) + | ^^ unnecessary `=>` +help: remove `=>` + 4 | (declare f (T -> T)) + | -------- diff --git a/tests/parser/parse-type.8.bad.error b/tests/parser/parse-type.8.bad.error new file mode 100644 index 000000000..911e1d668 --- /dev/null +++ b/tests/parser/parse-type.8.bad.error @@ -0,0 +1,5 @@ +error: Malformed type predicate + --> test:4:19 + | + 4 | (declare f ((T :a) T => T -> T)) + | ^ expected predicate diff --git a/tests/parser/parse-type.9.bad.error b/tests/parser/parse-type.9.bad.error new file mode 100644 index 000000000..e22a0666e --- /dev/null +++ b/tests/parser/parse-type.9.bad.error @@ -0,0 +1,8 @@ +error: Malformed type predicate + --> test:4:20 + | + 4 | (declare f ((T :a) ((T) :a) => T -> T)) + | ^^^ expected class name +help: remove parentheses + 4 | (declare f ((T :a) (T :a) => T -> T)) + | - diff --git a/tests/parser/parse-unless.1.bad.error b/tests/parser/parse-unless.1.bad.error new file mode 100644 index 000000000..be4289ff3 --- /dev/null +++ b/tests/parser/parse-unless.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed unless expression + --> test:4:18 + | + 4 | (define x (unless)) + | ^ expected a predicate diff --git a/tests/parser/parse-unless.2.bad.error b/tests/parser/parse-unless.2.bad.error new file mode 100644 index 000000000..6e07a3397 --- /dev/null +++ b/tests/parser/parse-unless.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed function + --> test:4:20 + | + 4 | (define x (unless 1)) + | ^ expected body diff --git a/tests/parser/parse-when.1.bad.error b/tests/parser/parse-when.1.bad.error new file mode 100644 index 000000000..d87297240 --- /dev/null +++ b/tests/parser/parse-when.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed when expression + --> test:4:16 + | + 4 | (define f (when)) + | ^ expected a predicate diff --git a/tests/parser/parse-when.2.bad.error b/tests/parser/parse-when.2.bad.error new file mode 100644 index 000000000..b96601c86 --- /dev/null +++ b/tests/parser/parse-when.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed function + --> test:4:18 + | + 4 | (define x (when 1)) + | ^ expected body diff --git a/tests/parser/parse-while-let.1.bad.error b/tests/parser/parse-while-let.1.bad.error new file mode 100644 index 000000000..a31fffef4 --- /dev/null +++ b/tests/parser/parse-while-let.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed while-let expression + --> test:4:21 + | + 4 | (define f (while-let)) + | ^ expected pattern diff --git a/tests/parser/parse-while-let.2.bad.error b/tests/parser/parse-while-let.2.bad.error new file mode 100644 index 000000000..d997e3fc1 --- /dev/null +++ b/tests/parser/parse-while-let.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed while-let expression + --> test:4:30 + | + 4 | (define f (while-let (Some x))) + | ^ expected = diff --git a/tests/parser/parse-while-let.3.bad.error b/tests/parser/parse-while-let.3.bad.error new file mode 100644 index 000000000..af9ce744e --- /dev/null +++ b/tests/parser/parse-while-let.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed while-let expression + --> test:4:32 + | + 4 | (define f (while-let (Some x) z)) + | ^ expected = diff --git a/tests/parser/parse-while-let.4.bad.error b/tests/parser/parse-while-let.4.bad.error new file mode 100644 index 000000000..63e5d3ce8 --- /dev/null +++ b/tests/parser/parse-while-let.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed while-let expression + --> test:4:38 + | + 4 | (define f (while-let (Some x) = (moo))) + | ^ expected body diff --git a/tests/parser/parse-while-let.5.bad.error b/tests/parser/parse-while-let.5.bad.error new file mode 100644 index 000000000..41e719397 --- /dev/null +++ b/tests/parser/parse-while-let.5.bad.error @@ -0,0 +1,5 @@ +error: Malformed while-let expression + --> test:4:45 + | + 4 | (define f (while-let :label (Some x) = (moo))) + | ^ expected body diff --git a/tests/parser/parse-while-let.6.bad.error b/tests/parser/parse-while-let.6.bad.error new file mode 100644 index 000000000..0820f3b03 --- /dev/null +++ b/tests/parser/parse-while-let.6.bad.error @@ -0,0 +1,5 @@ +error: Malformed while-let expression + --> test:4:28 + | + 4 | (define f (while-let :label)) + | ^ expected pattern diff --git a/tests/parser/parse-while-let.7.bad.error b/tests/parser/parse-while-let.7.bad.error new file mode 100644 index 000000000..08ba4ffdf --- /dev/null +++ b/tests/parser/parse-while-let.7.bad.error @@ -0,0 +1,5 @@ +error: Malformed while-let expression + --> test:4:32 + | + 4 | (define f (while-let :label foo)) + | ^ expected = diff --git a/tests/parser/parse-while-let.8.bad.error b/tests/parser/parse-while-let.8.bad.error new file mode 100644 index 000000000..b67f9b792 --- /dev/null +++ b/tests/parser/parse-while-let.8.bad.error @@ -0,0 +1,5 @@ +error: Malformed while-let expression + --> test:4:37 + | + 4 | (define f (while-let :label foo nope)) + | ^ expected = diff --git a/tests/parser/parse-while-let.9.bad.error b/tests/parser/parse-while-let.9.bad.error new file mode 100644 index 000000000..95739ef4c --- /dev/null +++ b/tests/parser/parse-while-let.9.bad.error @@ -0,0 +1,5 @@ +error: Malformed while-let expression + --> test:4:38 + | + 4 | (define f (while-let :label foo = bar)) + | ^ expected body diff --git a/tests/parser/parse-while.1.bad.error b/tests/parser/parse-while.1.bad.error new file mode 100644 index 000000000..e1072a927 --- /dev/null +++ b/tests/parser/parse-while.1.bad.error @@ -0,0 +1,5 @@ +error: Malformed while expression + --> test:4:17 + | + 4 | (define f (while)) + | ^ expected condition diff --git a/tests/parser/parse-while.2.bad.error b/tests/parser/parse-while.2.bad.error new file mode 100644 index 000000000..a30366985 --- /dev/null +++ b/tests/parser/parse-while.2.bad.error @@ -0,0 +1,5 @@ +error: Malformed while expression + --> test:4:23 + | + 4 | (define f (while false)) + | ^ expected body diff --git a/tests/parser/parse-while.3.bad.error b/tests/parser/parse-while.3.bad.error new file mode 100644 index 000000000..07502e1c4 --- /dev/null +++ b/tests/parser/parse-while.3.bad.error @@ -0,0 +1,5 @@ +error: Malformed while expression + --> test:4:24 + | + 4 | (define f (while :label)) + | ^ expected condition diff --git a/tests/parser/parse-while.4.bad.error b/tests/parser/parse-while.4.bad.error new file mode 100644 index 000000000..bd9141b38 --- /dev/null +++ b/tests/parser/parse-while.4.bad.error @@ -0,0 +1,5 @@ +error: Malformed while expression + --> test:4:29 + | + 4 | (define f (while :label True)) + | ^ expected body diff --git a/tests/parser/toplevel-progn.1.bad.error b/tests/parser/toplevel-progn.1.bad.error new file mode 100644 index 000000000..0229ed6ec --- /dev/null +++ b/tests/parser/toplevel-progn.1.bad.error @@ -0,0 +1,10 @@ +error: Invalid attribute for progn + --> test:4:0 + | + 4 | (repr :transparent) + | ^^^^^^^^^^^^^^^^^^^ progn cannot have attributes + 5 | (progn + | _- + 6 | | (define-type T + 7 | | (T Integer))) + | |_________________- when parsing progn diff --git a/tests/parser/toplevel-progn.2.bad.error b/tests/parser/toplevel-progn.2.bad.error new file mode 100644 index 000000000..5fe35b0e8 --- /dev/null +++ b/tests/parser/toplevel-progn.2.bad.error @@ -0,0 +1,8 @@ +error: Trailing attributes in progn + --> test:5:2 + | + 4 | (progn + | _- + 5 | | (repr :transparent)) + | | ^^^^^^^^^^^^^^^^^^^ progn cannot have trailing attributes + | |______________________- when parsing progn diff --git a/tests/utilities.lisp b/tests/utilities.lisp index 856cccf4f..97946eef1 100644 --- a/tests/utilities.lisp +++ b/tests/utilities.lisp @@ -14,6 +14,22 @@ ;; XXX: This will not check ordering of edges within vertices (set-equalp dag1 dag2)) +(defun check-string= (context a b) + "Fire a test failure assertion if strings A and B differ, reporting the first position at which this is true." + (let ((compare-len (min (length a) + (length b)))) + (loop :for i :from 0 :below compare-len + :unless (char= (aref a i) + (aref b i)) + :do (is (string= a b) + (format nil "Strings differ at offset ~A of ~A:~%A: ~A~%B: ~A" + context i a b)) + (return)) + (is (= (length a) + (length b)) + (format nil "Strings differ at offset ~A of ~A:~%~A~%~A" + context compare-len a b)))) + (defun check-coalton-types (toplevel-string &rest expected-types) (let ((*package* (make-package (or (and fiasco::*current-test* (fiasco::name-of fiasco::*current-test*))