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

fix: handle unhandled case in isCaptured #1068

Merged
merged 1 commit into from
Dec 13, 2020

Conversation

scolsen
Copy link
Contributor

@scolsen scolsen commented Dec 13, 2020

Previously, this function missed a case, namely, one where the head of a
type definition contains a concrete struct, like Maybe with a variable
argument, a. That is,

(deftype (Foo (Maybe a)) [x (Maybe a)])

Would throw a type error. This commit fixes that issue.

Previously, this function missed a case, namely, one where the head of a
type definition contains a concrete struct, like `Maybe` with a variable
argument, `a`. That is,

```
(deftype (Foo (Maybe a)) [x (Maybe a)])
```

Would throw a type error. This commit fixes that issue.
@scolsen
Copy link
Contributor Author

scolsen commented Dec 13, 2020

Before we merge this, it's not clear to me that we should even allow type heads such as (Foo (Maybe a))--as it doesn't seem to make sense?

In such a case, isn't it likely the author meant (Foo a) [x (Maybe a)] instead?

@scolsen scolsen requested a review from a team December 13, 2020 19:01
@TimDeve
Copy link
Contributor

TimDeve commented Dec 13, 2020

Yeah, I don't see what (deftype (Foo (Maybe a)) [x (Maybe a)]) would mean. Should this just output a clearer error message instead?

@scolsen
Copy link
Contributor Author

scolsen commented Dec 13, 2020

Yeah, I don't see what (deftype (Foo (Maybe a)) [x (Maybe a)]) would mean. Should this just output a clearer error message instead?

sounds good! I think we should keep this case for exhaustiveness reasons, but let me add an additional check for type heads that ensures all their types are variables.

@eriksvedang eriksvedang merged commit 321671c into carp-lang:master Dec 13, 2020
@TimDeve
Copy link
Contributor

TimDeve commented Dec 13, 2020

@scolsen That was merged too early, no?

@scolsen
Copy link
Contributor Author

scolsen commented Dec 14, 2020

@scolsen That was merged too early, no?

Yeah, it's ok though, I can push the other changes as a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants