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

Type synonym definitions with non-type arguments should give an error. #2297

Closed
lukaszcz opened this issue Aug 17, 2023 · 0 comments · Fixed by #2306
Closed

Type synonym definitions with non-type arguments should give an error. #2297

lukaszcz opened this issue Aug 17, 2023 · 0 comments · Fixed by #2306

Comments

@lukaszcz
Copy link
Collaborator

Currently, the definition

f : Nat → Type;
f zero := Nat;
f (suc _) := Bool;

type checks. However, it cannot be used. For example,

h : f zero := zero;

gives the error:

The expression zero has type:
  Nat
but is expected to have type:
  f zero

Since f cannot be used, it will be filtered out by reachability analysis. But the type signature of f should give a type error, because it's not really supported and translating f to Core is erroneous at this point, because the well-typedness assumptions in the Core pipelines don't support such type synonym definitions.

@lukaszcz lukaszcz added this to the 0.4.4 milestone Aug 17, 2023
@lukaszcz lukaszcz changed the title Type synonyms with non-type arguments should give an error. Type synonym definitions with non-type arguments should give an error. Aug 17, 2023
@janmasrovira janmasrovira self-assigned this Aug 23, 2023
@janmasrovira janmasrovira linked a pull request Aug 23, 2023 that will close this issue
lukaszcz pushed a commit that referenced this issue Aug 23, 2023
- Closes #2297 

When the type of function definition is of the form `... -> Type` it has
to have only one clause and no pattern matching.
@jonaprieto jonaprieto modified the milestones: 0.4.4, 0.5 Sep 7, 2023
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.

3 participants