Skip to content

Commit

Permalink
Fix checking type arguments for mut T and uni T
Browse files Browse the repository at this point in the history
When encountering these types in a signature, the compiler didn't verify
if these types specified the correct number of type arguments. This
meant you could write e.g. `mut Array` (instead of `mut Array[T]`), and
the compiler wouldn't produce an error.

Changelog: fixed
  • Loading branch information
yorickpeterse committed Oct 4, 2022
1 parent 68a5a86 commit f9375d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/src/type_check/mod.rs
Expand Up @@ -524,7 +524,10 @@ impl<'a> CheckTypeSignature<'a> {

pub(crate) fn check_type_name(&mut self, node: &hir::TypeName) {
match node.resolved_type {
TypeRef::Owned(id) | TypeRef::Ref(id) => match id {
TypeRef::Owned(id)
| TypeRef::Ref(id)
| TypeRef::Mut(id)
| TypeRef::Uni(id) => match id {
TypeId::ClassInstance(ins) => {
self.check_class_instance(node, ins);
}
Expand Down

0 comments on commit f9375d5

Please sign in to comment.