Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Type Variables can be both int vars and real vars #41

Open
sunjay opened this issue Nov 4, 2019 · 0 comments
Open

Type Variables can be both int vars and real vars #41

sunjay opened this issue Nov 4, 2019 · 0 comments

Comments

@sunjay
Copy link
Owner

sunjay commented Nov 4, 2019

Right now we assume that no types can be both int vars and real vars:

/// Records this type variable as an int var so it can be special-cased in the later stages of
/// type checking. No variable should be both an int var and a real var.
pub fn ty_var_is_int(&mut self, ty_var: TyVar) {
self.int_vars.insert(ty_var);
}
/// Records this type variable as an real var so it can be special-cased in the later stages of
/// type checking. No variable should be both an int var and a real var.
pub fn ty_var_is_real(&mut self, ty_var: TyVar) {
self.real_vars.insert(ty_var);
}

No variable should be both an int var and a real var.

This is not valid though because 12 is both a valid integer literal and a valid real literal. We should go through the code and remove this assumption.

A variable can be both an int var and a real var. In that case, the variable must be in the intersection of the set of valid types for both int and real vars.

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

No branches or pull requests

1 participant