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 assignment for internal expressions #1121

Open
wants to merge 70 commits into
base: dev
Choose a base branch
from
Open

type assignment for internal expressions #1121

wants to merge 70 commits into from

Conversation

ruiz-m
Copy link
Contributor

@ruiz-m ruiz-m commented Oct 16, 2023

Adds a module that performs type assignment after conducting elaboration.

Matt and others added 30 commits January 14, 2023 20:49
@ruiz-m ruiz-m marked this pull request as ready for review March 21, 2024 00:57
src/haz3lcore/dynamics/TypeAssignment.re Show resolved Hide resolved
src/haz3lcore/dynamics/TypeAssignment.re Show resolved Hide resolved
})
|> OptUtil.sequence;
let ctx' =
List.fold_left(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can probably combine the map above and this fold into one, but not critical

l2,
);
} else {
ctx;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to error out in cases like this

} else {
ctx;
};
| _ => ctx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use a wildcard here

| _ => None
};
| ApBuiltin(_)
| BuiltinFun(_) => None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to have a way of checking and looking up the type of a builtin, not just erroring on uses of builtins

None;
};
| ListLit(_, _, ty, _) => Some(List(ty))
| Cons(d1, ListLit(_, _, _, [])) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this case for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ListLits have types so don't need to special case nil...

| _ => None
};
| ListConcat(ListLit(_, _, _, []), d)
| ListConcat(d, ListLit(_, _, _, [])) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

src/haz3lcore/dynamics/TypeAssignment.re Show resolved Hide resolved
@cyrus- cyrus- marked this pull request as draft March 24, 2024 23:17
@cyrus- cyrus- changed the title Haz3l type assignment type assignment for internal expressions Apr 13, 2024
@cyrus- cyrus- marked this pull request as ready for review April 13, 2024 18:38

switch (typ_cases) {
| None => None
| Some(_) => Some(Typ.Unknown(Internal))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's actually check to make sure that there is at least one branch with an inconsistent type here

if (Typ.eq(ty, Bool)) {
let* _ = typ_of_dhexp(ctx, m, d1);
let* _ = typ_of_dhexp(ctx, m, d2);
Some(Typ.Unknown(Internal));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here -- let's actually check to make sure that there is at least one branch with an inconsistent type

| ExpandingKeyword(_)
| InvalidText(_)
| BadConstructor(_)
| IntLit(_)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should type check in these cases

@cyrus- cyrus- marked this pull request as draft April 17, 2024 03:39
@ruiz-m ruiz-m marked this pull request as ready for review May 27, 2024 14:28
@cyrus- cyrus- marked this pull request as draft May 30, 2024 19:42
@ruiz-m ruiz-m marked this pull request as ready for review June 3, 2024 17:14
Copy link
Member

@cyrus- cyrus- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good for a merge now, can you just remove the remaining prints that ended up in here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-polish for PRs that are substantially complete but need final polish
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants