Skip to content

Don't leak uninferred variables into type errors #292

Closed
@Marwes

Description

Sometimes errors can contain types that have unbound type variables which are represented by integers. These variables should instead be replaced by generalized variables (the type variables which are represented by starting with a lowercase letter in the source).

123 -> a -> Option Int

==>

a1 -> a -> Option Int

https://gitter.im/gluon-lang/gluon?at=592fd309631b8e4e61331814

Generalize here

if self.errors.has_errors() {
Err(mem::replace(&mut self.errors, Errors::new()))
} else {
match ::rename::rename(&mut self.symbols, &self.environment, expr) {
Ok(()) => {
debug!("Typecheck result: {}", typ);
Ok(typ)
}
Err(errors) => {
for Spanned { span, value } in errors {
self.errors
.push(Spanned {
span: span,
value: value.into(),
});
}
Err(mem::replace(&mut self.errors, Errors::new()))
}
}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions