Skip to content

Commit

Permalink
Merge pull request #1216 from veryl-lang/type_eval
Browse files Browse the repository at this point in the history
Introduce new type checker
  • Loading branch information
dalance authored Feb 11, 2025
2 parents b88d1c3 + 16eefc5 commit 3eb7740
Show file tree
Hide file tree
Showing 15 changed files with 1,478 additions and 540 deletions.
18 changes: 18 additions & 0 deletions crates/analyzer/src/analyzer_error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::evaluator::EvaluatedError;
use miette::{self, Diagnostic, NamedSource, SourceSpan};
use thiserror::Error;
use veryl_parser::veryl_token::TokenRange;
Expand Down Expand Up @@ -1756,4 +1757,21 @@ impl AnalyzerError {
error_location: token.into(),
}
}

pub fn evaluated_error(source: &str, error: &EvaluatedError) -> Self {
match error {
EvaluatedError::InvalidFactor { kind, token } => AnalyzerError::InvalidFactor {
identifier: token.to_string(),
kind: kind.clone(),
input: AnalyzerError::named_source(source, &token.into()),
error_location: token.into(),
},
EvaluatedError::CallNonFunction { kind, token } => AnalyzerError::CallNonFunction {
identifier: token.to_string(),
kind: kind.clone(),
input: AnalyzerError::named_source(source, &token.into()),
error_location: token.into(),
},
}
}
}
Loading

0 comments on commit 3eb7740

Please sign in to comment.