Introduce proper type for TypeVar's, mark anything not a lowercase ident as malformed

This commit is contained in:
Joshua Warner 2025-01-08 21:12:53 -08:00
parent a9c25563b2
commit d43ad92789
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
65 changed files with 729 additions and 460 deletions

View file

@ -4,7 +4,7 @@ use roc_can::scope::Scope;
use roc_collections::VecSet;
use roc_module::ident::ModuleName;
use roc_module::symbol::{IdentIds, ModuleId, ModuleIds, Symbol};
use roc_parse::ast::{self, ExtractSpaces, TypeHeader};
use roc_parse::ast::{self, ExtractSpaces, TypeHeader, TypeVar};
use roc_parse::ast::{AssignedField, FunctionArrow};
use roc_parse::ast::{CommentOrNewline, TypeDef, ValueDef};
@ -312,7 +312,7 @@ fn generate_entry_docs(
let mut type_vars = Vec::new();
for var in vars.iter() {
if let Pattern::Identifier { ident: ident_name } = var.value {
if let TypeVar::Identifier(ident_name) = var.value {
type_vars.push(ident_name.to_string());
}
}
@ -346,7 +346,7 @@ fn generate_entry_docs(
let mut type_vars = Vec::new();
for var in vars.iter() {
if let Pattern::Identifier { ident: ident_name } = var.value {
if let TypeVar::Identifier(ident_name) = var.value {
type_vars.push(ident_name.to_string());
}
}
@ -370,7 +370,7 @@ fn generate_entry_docs(
let mut type_vars = Vec::new();
for var in vars.iter() {
if let Pattern::Identifier { ident: ident_name } = var.value {
if let TypeVar::Identifier(ident_name) = var.value {
type_vars.push(ident_name.to_string());
}
}
@ -631,7 +631,7 @@ fn type_to_docs(in_func_type_ann: bool, type_annotation: ast::TypeAnnotation) ->
.vars
.iter()
.filter_map(|loc_pattern| match loc_pattern.value {
ast::Pattern::Identifier { ident } => Some(ident.to_string()),
ast::TypeVar::Identifier(ident) => Some(ident.to_string()),
_ => None,
})
.collect(),