Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Type name instead of constructor returns opaque unknown variable error #1095

Open
Izaakwltn opened this issue Apr 25, 2024 · 1 comment · May be fixed by #1097
Open

Using Type name instead of constructor returns opaque unknown variable error #1095

Izaakwltn opened this issue Apr 25, 2024 · 1 comment · May be fixed by #1097

Comments

@Izaakwltn
Copy link
Collaborator

This is a pretty minor nit, but when you call the type name instead of the constructor:

(defpackage #:unknown-variable-type-error
  (:use #:coalton
        #:coalton-prelude))

(in-package #:unknown-variable-type-error)

(coalton-toplevel

  (define-type DataType
    (Data1 Integer)
    (Data2 String))

  (define (return-data int)
    (DataType int)))

It returns the error:

(DATATYPE INT)))
 ^^^^^^^^ unknown variable

Which seems vague, and also, technically it's not an unknown variable.

@stylewarning
Copy link
Member

It is an unknown variable, but we should do a check to see if the "variable" defines a type, and say "did you mean a constructor of type FOO?"

@jbouwman jbouwman linked a pull request Apr 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants