diff --git a/.vscode/launch.json b/.vscode/launch.json index bf585bf031..c47ec79013 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -20,7 +20,9 @@ } }, "args": [ - "target/demo.st" + "--check", + "target/demo.st", + "-i","libs/stdlib/iec61131-st/timers.st" ], "cwd": "${workspaceFolder}" }, diff --git a/Cargo.lock b/Cargo.lock index 6f5bc9f2d6..83933171c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1978,7 +1978,9 @@ dependencies = [ name = "plc_diagnostics" version = "0.1.0" dependencies = [ + "anyhow", "codespan-reporting", + "lazy_static", "plc_ast", "plc_source", "serde_json", @@ -1988,6 +1990,7 @@ dependencies = [ name = "plc_driver" version = "0.1.0" dependencies = [ + "anyhow", "clap 3.2.25", "encoding_rs", "encoding_rs_io", @@ -2023,6 +2026,7 @@ dependencies = [ name = "plc_project" version = "0.1.0" dependencies = [ + "anyhow", "encoding_rs", "encoding_rs_io", "glob", @@ -2373,6 +2377,7 @@ dependencies = [ name = "rusty" version = "0.2.0" dependencies = [ + "anyhow", "chrono", "clap 3.2.25", "encoding_rs", diff --git a/Cargo.toml b/Cargo.toml index 7348c2536f..6d99fe8935 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,6 @@ regex = "1" serde = { version = "1.0", features = ["derive"] } serde_json = "1" toml = "0.5" -lazy_static = "1.4.0" shell-words = "1.1.0" plc_derive = { path = "./compiler/plc_derive" } lld_rs = "140.0.0" @@ -40,6 +39,8 @@ log.workspace = true inkwell.workspace = true chrono.workspace = true itertools.workspace = true +anyhow.workspace = true +lazy_static.workspace = true [dev-dependencies] num = "0.4" @@ -81,3 +82,5 @@ encoding_rs_io = "0.1" log = "0.4" chrono = { version = "0.4", default-features = false } itertools = "0.11" +anyhow = "1.0" +lazy_static = "1.4.0" diff --git a/compiler/plc_ast/src/ast.rs b/compiler/plc_ast/src/ast.rs index 2e2e2cd1fb..43a5744da3 100644 --- a/compiler/plc_ast/src/ast.rs +++ b/compiler/plc_ast/src/ast.rs @@ -157,6 +157,30 @@ impl TypeNature { } } +impl Display for TypeNature { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + let name = match self { + TypeNature::Any => "ANY", + TypeNature::Derived => "ANY_DERIVED", + TypeNature::Elementary => "ANY_ELEMENTARY", + TypeNature::Magnitude => "ANY_MAGNITUDE", + TypeNature::Num => "ANY_NUMBER", + TypeNature::Real => "ANY_REAL", + TypeNature::Int => "ANY_INT", + TypeNature::Signed => "ANY_SIGNED", + TypeNature::Unsigned => "ANY_UNSIGNED", + TypeNature::Duration => "ANY_DURATION", + TypeNature::Bit => "ANY_BIT", + TypeNature::Chars => "ANY_CHARS", + TypeNature::String => "ANY_STRING", + TypeNature::Char => "ANY_CHAR", + TypeNature::Date => "ANY_DATE", + TypeNature::__VLA => "__ANY_VLA", + }; + write!(f, "{name}") + } +} + impl DirectAccessType { /// Returns the size of the bitaccess result pub fn get_bit_width(&self) -> u64 { @@ -379,21 +403,6 @@ impl Variable { } } -pub trait DiagnosticInfo { - fn get_description(&self) -> String; - fn get_location(&self) -> SourceLocation; -} - -impl DiagnosticInfo for AstNode { - fn get_description(&self) -> String { - format!("{self:?}") - } - - fn get_location(&self) -> SourceLocation { - self.get_location() - } -} - #[derive(Clone, PartialEq)] pub enum DataTypeDeclaration { DataTypeReference { referenced_type: String, location: SourceLocation }, diff --git a/compiler/plc_diagnostics/Cargo.toml b/compiler/plc_diagnostics/Cargo.toml index c61a8f98e4..baad5e8f62 100644 --- a/compiler/plc_diagnostics/Cargo.toml +++ b/compiler/plc_diagnostics/Cargo.toml @@ -10,3 +10,5 @@ codespan-reporting = "0.11.1" plc_ast = { path = "../plc_ast" } plc_source = { path = "../plc_source" } serde_json = "1" +anyhow.workspace = true +lazy_static.workspace = true diff --git a/compiler/plc_diagnostics/src/diagnostician.rs b/compiler/plc_diagnostics/src/diagnostician.rs index 6ebbb628ef..1d1bc5651c 100644 --- a/compiler/plc_diagnostics/src/diagnostician.rs +++ b/compiler/plc_diagnostics/src/diagnostician.rs @@ -1,8 +1,7 @@ use std::collections::HashMap; use crate::{ - diagnostics::Diagnostic, - errno::ErrNo, + diagnostics::{Diagnostic, Severity}, reporter::{ clang::ClangFormatDiagnosticReporter, codespan::CodeSpanDiagnosticReporter, null::NullDiagnosticReporter, DiagnosticReporter, ResolvedDiagnostics, ResolvedLocation, @@ -35,13 +34,10 @@ impl Diagnostician { pub fn handle(&mut self, diagnostics: &[Diagnostic]) -> Severity { let resolved_diagnostics = diagnostics .iter() - .flat_map(|it| match it { - Diagnostic::CombinedDiagnostic { inner_diagnostics, .. } => { - let mut res = vec![it]; - res.extend(inner_diagnostics.iter().collect::>()); - res - } - _ => vec![it], + .flat_map(|it| { + let mut res = vec![it]; + res.extend(it.get_sub_diagnostics()); + res }) .map(|d| ResolvedDiagnostics { message: d.get_message().to_string(), @@ -148,30 +144,14 @@ pub struct DefaultDiagnosticAssessor; impl DiagnosticAssessor for DefaultDiagnosticAssessor { fn assess(&self, d: &Diagnostic) -> Severity { - match d { - // improvements become warnings - Diagnostic::ImprovementSuggestion { .. } => Severity::Warning, - _ if *d.get_type() == ErrNo::reference__unresolved => Severity::Critical, - // everything else becomes an error - _ => Severity::Error, - } + //TODO: Refer to some severity map to reassign severity here. + d.get_severity() } } -/// a diagnostics severity -#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] -pub enum Severity { - #[default] - Info, - Warning, - Error, - Critical, -} - impl std::fmt::Display for Severity { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let severity = match self { - Severity::Critical => "critical", Severity::Error => "error", Severity::Warning => "warning", Severity::Info => "info", diff --git a/compiler/plc_diagnostics/src/diagnostics.rs b/compiler/plc_diagnostics/src/diagnostics.rs index 29ac67b7e2..5ed1afe340 100644 --- a/compiler/plc_diagnostics/src/diagnostics.rs +++ b/compiler/plc_diagnostics/src/diagnostics.rs @@ -1,847 +1,478 @@ -use std::{error::Error, fmt::Display, ops::Range}; - -use plc_ast::ast::{AstNode, DataTypeDeclaration, DiagnosticInfo, PouType}; +use std::fmt::Display; +use plc_ast::ast::AstNode; use plc_source::{ source_location::{SourceLocation, SourceLocationFactory}, - BuildDescriptionSource, + SourceCode, }; -use crate::errno::ErrNo; +mod diagnostics_registry { + macro_rules! add_diagnostic { + ($($number:ident, $desc:expr,)*) => { + use lazy_static::lazy_static; + lazy_static! { + static ref DIAGNOSTICS : HashMap<&'static str, &'static str> = { + let mut m : HashMap<&str, &str> = HashMap::new(); + $( m.insert(stringify!($number), $desc);)* + m + }; + } + } +} + + use std::collections::HashMap; + + #[derive(Default)] + pub struct DiagnosticsRegistry(HashMap<&'static str, &'static str>); + add_diagnostic!( + E001, + include_str!("./error_codes/E001.md"), //General Error + E002, + include_str!("./error_codes/E002.md"), //General IO Error + E003, + include_str!("./error_codes/E003.md"), //Parameter Error + E004, + include_str!("./error_codes/E004.md"), //Duplicate Symbol + E005, + include_str!("./error_codes/E005.md"), //Generic LLVM Error + E006, + include_str!("./error_codes/E006.md"), //Missing Token + E007, + include_str!("./error_codes/E007.md"), //Unexpected Token + E008, + include_str!("./error_codes/E008.md"), //Invalid Range + E009, + include_str!("./error_codes/E009.md"), //Mismatched Parantheses + E010, + include_str!("./error_codes/E010.md"), //Invalid Time Literal + E011, + include_str!("./error_codes/E011.md"), //Invalid Number + E012, + include_str!("./error_codes/E012.md"), //Missing Case Condition + E013, + include_str!("./error_codes/E013.md"), + E014, + include_str!("./error_codes/E014.md"), + E015, + include_str!("./error_codes/E015.md"), + E016, + include_str!("./error_codes/E016.md"), + E017, + include_str!("./error_codes/E017.md"), + E018, + include_str!("./error_codes/E018.md"), + E019, + include_str!("./error_codes/E019.md"), + E020, + include_str!("./error_codes/E020.md"), + E021, + include_str!("./error_codes/E021.md"), + E022, + include_str!("./error_codes/E022.md"), + E023, + include_str!("./error_codes/E023.md"), + E024, + include_str!("./error_codes/E024.md"), + E025, + include_str!("./error_codes/E025.md"), + E026, + include_str!("./error_codes/E026.md"), + E027, + include_str!("./error_codes/E027.md"), + E028, + include_str!("./error_codes/E028.md"), + E029, + include_str!("./error_codes/E029.md"), + E030, + include_str!("./error_codes/E030.md"), + E031, + include_str!("./error_codes/E031.md"), + E032, + include_str!("./error_codes/E032.md"), + E033, + include_str!("./error_codes/E033.md"), + E034, + include_str!("./error_codes/E034.md"), + E035, + include_str!("./error_codes/E035.md"), + E036, + include_str!("./error_codes/E036.md"), + E037, + include_str!("./error_codes/E037.md"), + E038, + include_str!("./error_codes/E038.md"), + E039, + include_str!("./error_codes/E039.md"), + E040, + include_str!("./error_codes/E040.md"), + E041, + include_str!("./error_codes/E041.md"), + E042, + include_str!("./error_codes/E042.md"), + E043, + include_str!("./error_codes/E043.md"), + E044, + include_str!("./error_codes/E044.md"), + E045, + include_str!("./error_codes/E045.md"), + E046, + include_str!("./error_codes/E046.md"), + E047, + include_str!("./error_codes/E047.md"), + E048, + include_str!("./error_codes/E048.md"), + E049, + include_str!("./error_codes/E049.md"), + E050, + include_str!("./error_codes/E050.md"), + E051, + include_str!("./error_codes/E051.md"), + E052, + include_str!("./error_codes/E052.md"), + E053, + include_str!("./error_codes/E053.md"), + E054, + include_str!("./error_codes/E054.md"), + E055, + include_str!("./error_codes/E055.md"), + E056, + include_str!("./error_codes/E056.md"), + E057, + include_str!("./error_codes/E057.md"), + E058, + include_str!("./error_codes/E058.md"), + E059, + include_str!("./error_codes/E059.md"), + E060, + include_str!("./error_codes/E060.md"), + E061, + include_str!("./error_codes/E061.md"), + E062, + include_str!("./error_codes/E062.md"), + E063, + include_str!("./error_codes/E063.md"), + E064, + include_str!("./error_codes/E064.md"), + E065, + include_str!("./error_codes/E065.md"), + E066, + include_str!("./error_codes/E066.md"), + E067, + include_str!("./error_codes/E067.md"), + E068, + include_str!("./error_codes/E068.md"), + E069, + include_str!("./error_codes/E069.md"), + E070, + include_str!("./error_codes/E070.md"), + E071, + include_str!("./error_codes/E071.md"), + E072, + include_str!("./error_codes/E072.md"), + E073, + include_str!("./error_codes/E073.md"), + E074, + include_str!("./error_codes/E074.md"), + E075, + include_str!("./error_codes/E075.md"), + E076, + include_str!("./error_codes/E076.md"), + E077, + include_str!("./error_codes/E077.md"), + E078, + include_str!("./error_codes/E078.md"), + E079, + include_str!("./error_codes/E079.md"), + E080, + include_str!("./error_codes/E080.md"), + E081, + include_str!("./error_codes/E081.md"), + E082, + include_str!("./error_codes/E082.md"), + E083, + include_str!("./error_codes/E083.md"), + E084, + include_str!("./error_codes/E084.md"), + E085, + include_str!("./error_codes/E085.md"), + E086, + include_str!("./error_codes/E086.md"), + E087, + include_str!("./error_codes/E087.md"), + E088, + include_str!("./error_codes/E088.md"), + E089, + include_str!("./error_codes/E089.md"), + E090, + include_str!("./error_codes/E090.md"), + ); +} pub const INTERNAL_LLVM_ERROR: &str = "internal llvm codegen error"; -#[derive(PartialEq, Eq, Debug, Clone)] -pub enum Diagnostic { - SyntaxError { message: String, range: Vec, err_no: ErrNo }, - SemanticError { message: String, range: Vec, err_no: ErrNo }, - GeneralError { message: String, err_no: ErrNo }, - ImprovementSuggestion { message: String, range: Vec }, - CombinedDiagnostic { message: String, inner_diagnostics: Vec, err_no: ErrNo }, +/// a diagnostics severity +#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] +pub enum Severity { + #[default] + Info, + Warning, + Error, } +/// The `Diagnostics` struct describes an issue encountered during compile time. +/// The issue is defined by an `error_code` and had a defined `severity` +/// Diagnostic severity can be overridden when being reported. #[derive(Debug)] -pub struct SerdeError { +pub struct Diagnostic { + /// The Description of the error being reported. message: String, - line: usize, - column: usize, + /// Primary location where the diagnostic occurred + primary_location: SourceLocation, + /// Seconday locations relevant to the diagnostics + secondary_locations: Option>, + /// Severity of the error being reported + severity: Severity, + /// Error code for reference in the documentation + error_code: &'static str, + /// Children of the current diagnostic + sub_diagnostics: Vec, + /// If the diagnostic is caused by an error, this field contains the original error + internal_error: Option, } -impl Display for Diagnostic { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}: {}", self.get_type(), self.get_message())?; - let location = self.get_location(); - if !location.is_undefined() { - write!(f, " at: {location}") - } else { - Ok(()) - } +impl std::error::Error for Diagnostic { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + self.internal_error.as_ref().and_then(|it| it.source()) } } -impl From for Diagnostic { - fn from(e: T) -> Self { - Diagnostic::GeneralError { message: e.to_string(), err_no: ErrNo::general__io_err } +impl From for Diagnostic { + fn from(value: std::io::Error) -> Self { + Diagnostic::error(value.to_string()).with_error_code("E002").with_internal_error(value.into()) } } +/// Builder for Diagnostics impl Diagnostic { - /// Creates a new diagnostic with additional ranges - pub fn with_extra_ranges(self, ranges: &[SourceLocation]) -> Diagnostic { - match self { - Diagnostic::SyntaxError { message, mut range, err_no } => { - range.extend_from_slice(ranges); - Diagnostic::SyntaxError { message, range, err_no } - } - Diagnostic::SemanticError { message, mut range, err_no } => { - range.extend_from_slice(ranges); - Diagnostic::SyntaxError { message, range, err_no } - } - Diagnostic::ImprovementSuggestion { message, mut range } => { - range.extend_from_slice(ranges); - Diagnostic::ImprovementSuggestion { message, range } - } - _ => self, + pub fn new(message: impl Into, severity: Severity) -> Self { + Diagnostic { + message: message.into(), + severity, + primary_location: SourceLocation::undefined(), + secondary_locations: Default::default(), + error_code: "E001", //Default error if none specified + sub_diagnostics: Default::default(), + internal_error: Default::default(), } } - pub fn syntax_error(message: &str, range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: message.to_string(), - range: vec![range], - err_no: ErrNo::syntax__generic_error, - } + pub fn error(message: impl Into) -> Self { + Self::new(message, Severity::Error) } - - pub fn unexpected_token_found(expected: &str, found: &str, range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Unexpected token: expected {expected} but found {found}"), - range: vec![range], - err_no: ErrNo::syntax__unexpected_token, - } + pub fn warning(message: impl Into) -> Self { + Self::new(message, Severity::Warning) } - - pub fn unexpected_initializer_on_function_return(range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "Return types cannot have a default value".into(), - range: vec![range], - err_no: ErrNo::syntax__unexpected_token, - } + pub fn info(message: impl Into) -> Self { + Self::new(message, Severity::Info) } - pub fn return_type_not_supported(pou_type: &PouType, range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("POU Type {pou_type:?} does not support a return type. Did you mean Function?"), - range: vec![range], - err_no: ErrNo::pou__unexpected_return_type, - } + pub fn with_location(mut self, location: SourceLocation) -> Self { + self.primary_location = location; + self } - //TODO: This prints a debug version of the datatype, it should have a user readable version instead - pub fn function_unsupported_return_type(data_type: &DataTypeDeclaration) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Data Type {data_type:?} not supported as a function return type!"), - range: vec![data_type.get_location()], - err_no: ErrNo::pou__unsupported_return_type, - } + pub fn with_secondary_location(mut self, location: SourceLocation) -> Self { + self.secondary_locations.get_or_insert_with(Default::default).push(location); + self } - pub fn function_return_missing(range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "Function Return type missing".into(), - range: vec![range], - err_no: ErrNo::pou__missing_return_type, - } + pub fn with_secondary_locations(mut self, locations: Vec) -> Self { + self.secondary_locations.get_or_insert_with(Default::default).extend(locations); + self } - pub fn missing_function(location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "Cannot generate code outside of function context.".into(), - range: vec![location], - err_no: ErrNo::codegen__missing_function, - } + pub fn with_error_code(mut self, error_code: &'static str) -> Self { + self.error_code = error_code; + self } - pub fn missing_compare_function( - function_name: &str, - data_type: &str, - location: SourceLocation, - ) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!( - "Missing compare function 'FUNCTION {function_name} : BOOL VAR_INPUT a,b : {data_type}; END_VAR ...'." - ), - range: vec![location], - err_no: ErrNo::codegen__missing_compare_function, - } + pub fn with_sub_diagnostic(mut self, diagnostic: Diagnostic) -> Self { + self.sub_diagnostics.push(diagnostic); + self } - pub fn missing_token(expected_token: &str, range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Missing expected Token {expected_token}"), - range: vec![range], - err_no: ErrNo::syntax__missing_token, - } + pub fn with_sub_diagnostics(mut self, diagnostics: Vec) -> Self { + self.sub_diagnostics.extend(diagnostics); + self } - pub fn missing_action_container(range: SourceLocation) -> Diagnostic { - Diagnostic::ImprovementSuggestion { - message: "Missing Actions Container Name".to_string(), - range: vec![range], - } + pub fn with_internal_error(mut self, error: anyhow::Error) -> Self { + self.internal_error = Some(error); + self } - pub fn unresolved_reference(reference: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Could not resolve reference to {reference:}"), - range: vec![location], - err_no: ErrNo::reference__unresolved, - } - } + pub fn from_serde_error(error: serde_json::Error, source: &SourceCode) -> Self { + let factory = SourceLocationFactory::for_source(source); + let line = error.line(); + let column = error.column(); - pub fn illegal_access(reference: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Illegal access to private member {reference:}"), - range: vec![location], - err_no: ErrNo::reference__illegal_access, - } + // remove line, column from message + let message = error.to_string(); + let message = if let Some(pos) = message.find("at line") { + message.chars().take(pos).collect() + } else { + message + }; + let range = factory.create_range_to_end_of_line(line, column); + Diagnostic::error(message).with_error_code("E088").with_location(range) } +} - pub fn unresolved_generic_type(symbol: &str, nature: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Could not resolve generic type {symbol} with nature {nature}"), - range: vec![location], - err_no: ErrNo::type__unresolved_generic, - } +impl PartialOrd for Diagnostic { + fn partial_cmp(&self, other: &Self) -> Option { + self.severity.partial_cmp(&other.severity) } +} - pub fn unknown_type(type_name: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Unknown type: {type_name:}"), - range: vec![location], - err_no: ErrNo::type__unknown_type, - } +impl Ord for Diagnostic { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.severity.cmp(&other.severity) } +} - pub fn casting_error(type_name: &str, target_type: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Cannot cast from {type_name:} to {target_type:}"), - range: vec![location], - err_no: ErrNo::type__cast_error, - } +impl PartialEq for Diagnostic { + fn eq(&self, other: &Self) -> bool { + self.error_code == other.error_code + && self.message == other.message + && self.primary_location == other.primary_location + && self.secondary_locations == other.secondary_locations + && self.severity == other.severity + && self.sub_diagnostics == other.sub_diagnostics } +} - pub fn incompatible_directaccess( - access_type: &str, - access_size: u64, - location: SourceLocation, - ) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!( - "{access_type}-Wise access requires a Numerical type larger than {access_size} bits" - ), - range: vec![location], - err_no: ErrNo::type__incompatible_directaccess, - } - } +impl Eq for Diagnostic {} - pub fn incompatible_directaccess_range( - access_type: &str, - target_type: &str, - access_range: Range, - location: SourceLocation, - ) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!( - "{access_type}-Wise access for type {target_type} must be in the range {}..{}", - access_range.start, access_range.end - ), - range: vec![location], - err_no: ErrNo::type__incompatible_directaccess_range, +impl Display for Diagnostic { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}: {}", self.get_type(), self.get_message())?; + let location = self.get_location(); + if !location.is_undefined() { + write!(f, " at: {location}") + } else { + Ok(()) } } +} - pub fn incompatible_directaccess_variable(access_type: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!( - "Invalid type {access_type} for direct variable access. Only variables of Integer types are allowed", - ), - range: vec![location], - err_no: ErrNo::type__incompatible_directaccess_variable, - } +impl Diagnostic { + pub fn get_message(&self) -> &str { + self.message.as_str() } - pub fn incompatible_array_access_range(range: Range, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Array access must be in the range {}..{}", range.start, range.end), - range: vec![location], - err_no: ErrNo::type__incompatible_arrayaccess_range, - } + pub fn get_location(&self) -> SourceLocation { + self.primary_location.clone() } - pub fn incompatible_array_access_variable(access_type: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!( - "Invalid type {access_type} for array access. Only variables of Array types are allowed", - ), - range: vec![location], - err_no: ErrNo::type__incompatible_arrayaccess_variable, - } + pub fn get_secondary_locations(&self) -> Option<&[SourceLocation]> { + self.secondary_locations.as_deref() } - pub fn incompatible_array_access_type(access_type: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!( - "Invalid type {access_type} for array access. Only variables of Integer types are allowed to access an array", - ), - range: vec![location], - err_no: ErrNo::type__incompatible_arrayaccess_variable, - } + pub fn get_type(&self) -> &'static str { + self.error_code } - pub fn incompatible_literal_cast( - cast_type: &str, - literal_type: &str, - location: SourceLocation, - ) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Literal {literal_type} is not compatible to {cast_type}"), - range: vec![location], - err_no: ErrNo::type__incompatible_literal_cast, - } + pub fn get_severity(&self) -> Severity { + self.severity } - pub fn literal_expected(location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "Expected literal".into(), - range: vec![location], - err_no: ErrNo::type__expected_literal, - } + pub fn get_sub_diagnostics(&self) -> &[Diagnostic] { + &self.sub_diagnostics } +} - pub fn literal_out_of_range(literal: &str, range_hint: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Literal {literal} out of range ({range_hint})"), - range: vec![location], - err_no: ErrNo::type__literal_out_of_range, - } +//Helper methods for diagnostics +impl Diagnostic { + pub fn unexpected_token_found(expected: &str, found: &str, range: SourceLocation) -> Diagnostic { + Diagnostic::error(format!("Unexpected token: expected {expected} but found {found}")) + .with_error_code("E007") + .with_location(range) } - pub fn reference_expected(location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "Expression is not assignable".into(), - range: vec![location], - err_no: ErrNo::reference__expected, - } + pub fn missing_function(location: SourceLocation) -> Diagnostic { + Diagnostic::error("Cannot generate code outside of function context.") + .with_error_code("E072") + .with_location(location) } - pub fn empty_variable_block(location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "Variable block is empty".into(), - range: vec![location], - err_no: ErrNo::pou__empty_variable_block, - } + pub fn codegen_error(message: impl Into, location: SourceLocation) -> Diagnostic { + Diagnostic::error(message).with_location(location).with_error_code("E071") } - pub fn unresolved_constant( - constant_name: &str, - reason: Option<&str>, - location: SourceLocation, - ) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!( - "Unresolved constant '{constant_name:}' variable{:}", - reason.map(|it| format!(": {it}",)).unwrap_or_else(|| "".into()), - ), - range: vec![location], - err_no: ErrNo::var__unresolved_constant, - } + pub fn llvm_error(file: &str, llvm_error: &str) -> Diagnostic { + Diagnostic::error(format!("{file}: Internal llvm error: {:}", llvm_error)).with_error_code("E005") } - pub fn invalid_constant_block(location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "This variable block does not support the CONSTANT modifier".to_string(), - range: vec![location], - err_no: ErrNo::var__invalid_constant_block, - } + pub fn missing_token(expected_token: &str, range: SourceLocation) -> Diagnostic { + Diagnostic::error(format!("Missing expected Token {expected_token}")) + .with_location(range) + .with_error_code("E006") } - pub fn invalid_constant(constant_name: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!( - "Invalid constant {constant_name} - Functionblock- and Class-instances cannot be delcared constant", - ), - range: vec![location], - err_no: ErrNo::var__invalid_constant, - } + pub fn invalid_parameter_count(expected: usize, received: usize, location: SourceLocation) -> Diagnostic { + Diagnostic::error( + format!( + "Invalid parameter count. Received {received} parameters while {expected} parameters were expected.", + )).with_error_code("E032") + .with_location(location) } - pub fn cannot_assign_to_constant(qualified_name: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Cannot assign to CONSTANT '{qualified_name}'"), - range: vec![location], - err_no: ErrNo::var__cannot_assign_to_const, - } + pub fn unknown_type(type_name: &str, location: SourceLocation) -> Diagnostic { + Diagnostic::error(format!("Unknown type: {type_name:}")) + .with_error_code("E052") + .with_location(location) } - pub fn cannot_generate_initializer(variable_name: &str, location: SourceLocation) -> Diagnostic { - Self::codegen_error( - &format!("Cannot generate literal initializer for '{variable_name}': Value cannot be derived"), - location, - ) + pub fn unresolved_reference(reference: &str, location: SourceLocation) -> Diagnostic { + Diagnostic::error(format!("Could not resolve reference to {reference:}")) + .with_error_code("E048") + .with_location(location) } - pub fn codegen_error(message: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: message.into(), - range: vec![location], - err_no: ErrNo::codegen__general, - } + pub fn invalid_assignment(right_type: &str, left_type: &str, location: SourceLocation) -> Diagnostic { + Diagnostic::error(format!("Invalid assignment: cannot assign '{right_type}' to '{left_type}'")) + .with_error_code("E037") + .with_location(location) } - pub fn debug_error>(message: T) -> Diagnostic { - Diagnostic::GeneralError { message: message.into(), err_no: ErrNo::debug_general } + pub fn cannot_generate_initializer(variable_name: &str, location: SourceLocation) -> Diagnostic { + Self::error(format!( + "Cannot generate literal initializer for '{variable_name}': Value cannot be derived" + )) + .with_error_code("E041") + .with_location(location) } - pub fn cannot_generate_call_statement(operator: &T) -> Diagnostic { + pub fn cannot_generate_call_statement(operator: &AstNode) -> Diagnostic { + //TODO: We could probably get a better slice here Diagnostic::codegen_error( - &format!("cannot generate call statement for {:?}", operator.get_description()), + format!("cannot generate call statement for {:?}", operator), operator.get_location(), ) } - pub fn io_read_error(file: &str, reason: &str) -> Diagnostic { - Diagnostic::GeneralError { - message: format!("Cannot read file '{file}': {reason}'"), - err_no: ErrNo::general__io_err, - } - } - - pub fn io_write_error(file: &str, reason: &str) -> Diagnostic { - Diagnostic::GeneralError { - message: format!("Cannot write file {file} {reason}'"), - err_no: ErrNo::general__io_err, - } - } - - pub fn param_error(reason: &str) -> Diagnostic { - Diagnostic::GeneralError { message: reason.to_string(), err_no: ErrNo::general__param_err } - } - - pub fn llvm_error(file: &str, llvm_error: &str) -> Diagnostic { - Diagnostic::GeneralError { - message: format!("{file}: Internal llvm error: {:}", llvm_error), - err_no: ErrNo::general__io_err, - } - } - pub fn cannot_generate_from_empty_literal(type_name: &str, location: SourceLocation) -> Diagnostic { Diagnostic::codegen_error( format!("Cannot generate {type_name} from empty literal").as_str(), location, ) } - - pub fn cannot_generate_string_literal(type_name: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::codegen_error( - format!("Cannot generate String-Literal for type {type_name}").as_str(), - location, - ) - } - - pub fn invalid_assignment(right_type: &str, left_type: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Invalid assignment: cannot assign '{right_type}' to '{left_type}'"), - range: vec![location], - err_no: ErrNo::var__invalid_assignment, - } - } - - pub fn invalid_type_nature(actual: &str, expected: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Invalid type nature for generic argument. {actual} is no {expected}."), - range: vec![location], - err_no: ErrNo::type__invalid_nature, - } - } - - pub fn unknown_type_nature(nature: &str, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Unknown type nature {nature}."), - range: vec![location], - err_no: ErrNo::type__unknown_nature, - } - } - - pub fn missing_datatype(reason: Option<&str>, location: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Missing datatype {}", reason.unwrap_or("")), - range: vec![location], - err_no: ErrNo::var__missing_type, - } - } - - pub fn incompatible_type_size( - nature: &str, - size: u32, - error: &str, - location: SourceLocation, - ) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("The type {nature} {size} is too small to {error} Pointer"), - range: vec![location], - err_no: ErrNo::type__incompatible_size, - } - } - - pub fn link_error(error: &str) -> Diagnostic { - Diagnostic::GeneralError { err_no: ErrNo::linker__generic_error, message: error.to_string() } - } - - pub fn get_message(&self) -> &str { - match self { - Diagnostic::SyntaxError { message, .. } - | Diagnostic::SemanticError { message, .. } - | Diagnostic::ImprovementSuggestion { message, .. } - | Diagnostic::GeneralError { message, .. } - | Diagnostic::CombinedDiagnostic { message, .. } => message.as_str(), - } - } - - pub fn get_location(&self) -> SourceLocation { - match self { - Diagnostic::SyntaxError { range, .. } - | Diagnostic::SemanticError { range, .. } - | Diagnostic::ImprovementSuggestion { range, .. } => { - range.get(0).cloned().unwrap_or_else(SourceLocation::undefined) - } - _ => SourceLocation::undefined(), - } - } - - pub fn get_secondary_locations(&self) -> Option<&[SourceLocation]> { - match self { - Diagnostic::SyntaxError { range, .. } - | Diagnostic::SemanticError { range, .. } - | Diagnostic::ImprovementSuggestion { range, .. } - if range.len() > 1 => - { - Some(&range[1..]) - } - _ => None, - } - } - - pub fn get_type(&self) -> &ErrNo { - match self { - Diagnostic::SyntaxError { err_no, .. } - | Diagnostic::SemanticError { err_no, .. } - | Diagnostic::GeneralError { err_no, .. } - | Diagnostic::CombinedDiagnostic { err_no, .. } => err_no, - Diagnostic::ImprovementSuggestion { .. } => &ErrNo::undefined, - } - } - - /** - * relocates the given diagnostic to the given location if possible and returns it back - */ - pub fn relocate(it: Diagnostic, new_location: SourceLocation) -> Diagnostic { - match it { - Diagnostic::SyntaxError { message, err_no, .. } => { - Diagnostic::SyntaxError { message, range: vec![new_location], err_no } - } - Diagnostic::ImprovementSuggestion { message, .. } => { - Diagnostic::ImprovementSuggestion { message, range: vec![new_location] } - } - _ => it, - } - } - - pub fn invalid_pragma_location(message: &str, range: SourceLocation) -> Diagnostic { - Diagnostic::ImprovementSuggestion { - message: format!("Invalid pragma location: {message}"), - range: vec![range], - } - } - - pub fn non_constant_case_condition(case: &str, range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("{case}. Non constant variables are not supported in case conditions"), - range: vec![range], - err_no: ErrNo::type__invalid_type, - } - } - - pub fn duplicate_case_condition(value: &i128, range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Duplicate condition value: {value}. Occurred more than once!"), - range: vec![range], - err_no: ErrNo::case__duplicate_condition, - } - } - - pub fn case_condition_used_outside_case_statement(range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "Case condition used outside of case statement! Did you mean to use ';'?".into(), - range: vec![range], - err_no: ErrNo::case__case_condition_outside_case_statement, - } - } - - pub fn invalid_case_condition(range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "Invalid case condition!".into(), - range: vec![range], - err_no: ErrNo::case__case_condition_outside_case_statement, - } - } - - pub fn missing_inout_parameter(parameter: &str, range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Missing inout parameter: {parameter}"), - range: vec![range], - err_no: ErrNo::pou__missing_action_container, - } - } - - pub fn invalid_parameter_type(range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "Cannot mix implicit and explicit call parameters!".into(), - range: vec![range], - err_no: ErrNo::call__invalid_parameter_type, - } - } - - pub fn invalid_parameter_count(expected: usize, received: usize, range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!( - "Invalid parameter count. Received {received} parameters while {expected} parameters were expected.", - ), - range: vec![range], - err_no: ErrNo::call__invalid_parameter_count, - } - } - - pub fn implicit_downcast( - actual_type_name: &str, - assigned_type_name: &str, - range: SourceLocation, - ) -> Diagnostic { - Diagnostic::ImprovementSuggestion { - message: format!( - "Potential loss of information due to assigning '{assigned_type_name}' to variable of type '{actual_type_name}'." - ), - range: vec![range], - } - } - - pub fn invalid_argument_type( - parameter_name: &str, - parameter_type: &str, - range: SourceLocation, - ) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!( - "Expected a reference for parameter {parameter_name} because their type is {parameter_type}" - ), - range: vec![range], - err_no: ErrNo::call__invalid_parameter_type, - } - } - - pub fn invalid_type_name(name: &str, range: Vec) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("{name} can not be used as a name because it is a built-in datatype"), - range, - err_no: ErrNo::type__invalid_name, - } - } - - pub fn global_name_conflict( - name: &str, - location: SourceLocation, - conflicts: Vec, - ) -> Diagnostic { - Diagnostic::global_name_conflict_with_text(name, location, conflicts, "Duplicate symbol.") - } - - pub fn duplicate_label( - name: &str, - location: SourceLocation, - conflicts: Vec, - ) -> Diagnostic { - Diagnostic::global_name_conflict_with_text(name, location, conflicts, "Duplicate label.") - } - - pub fn global_name_conflict_with_text( - name: &str, - location: SourceLocation, - conflicts: Vec, - additional_text: &str, - ) -> Diagnostic { - let mut locations = vec![location]; - locations.extend(conflicts); - Diagnostic::SyntaxError { - message: format!("{name}: {additional_text}"), - range: locations, - err_no: ErrNo::duplicate_symbol, - } - } - - pub fn invalid_operation(message: &str, range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: message.to_string(), - range: vec![range], - err_no: ErrNo::type__invalid_operation, - } - } - - pub fn array_assignment(range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "Array assignments must be surrounded with `[]`".to_string(), - range: vec![range], - err_no: ErrNo::arr__invalid_array_assignment, - } - } - - pub fn array_struct_assignment(range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: "Struct initializers within arrays have to be wrapped by `()`".to_string(), - range: vec![range], - err_no: ErrNo::arr__invalid_array_assignment, - } - } - - pub fn array_size(name: &str, len_lhs: usize, len_rhs: usize, range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { - message: format!("Array `{name}` has a size of {len_lhs}, but {len_rhs} elements were provided"), - range: vec![range], - err_no: ErrNo::arr__invalid_array_assignment, - } - } - - pub fn recursive_datastructure(path: &str, range: Vec) -> Diagnostic { - Diagnostic::SemanticError { - message: format!("Recursive data structure `{path}` has infinite size"), - range, - err_no: ErrNo::pou__recursive_data_structure, - } - } - - pub fn vla_by_val_warning(range: SourceLocation) -> Diagnostic { - Diagnostic::ImprovementSuggestion { - message: "Variable Length Arrays are always by-ref, even when declared in a by-value block" - .to_string(), - range: vec![range], - } - } - - pub fn invalid_vla_container(message: String, range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { message, range: vec![range], err_no: ErrNo::vla__invalid_container } - } - - pub fn invalid_array_access(expected: usize, actual: usize, range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { - message: format!("Expected array access with {expected} dimensions, found {actual}"), - range: vec![range], - err_no: ErrNo::vla__invalid_array_access, - } - } - - pub fn invalid_range_statement(entity: &AstNode, range: SourceLocation) -> Diagnostic { - Diagnostic::SyntaxError { - message: format!("Expected a range statement, got {entity:?} instead"), - range: vec![range], - err_no: ErrNo::syntax__unexpected_token, - } - } - - pub fn var_input_ref_assignment(location: SourceLocation) -> Diagnostic { - Diagnostic::ImprovementSuggestion { - message: - "VAR_INPUT {ref} variables are mutable and changes to them will also affect the referenced variable. For increased clarity use VAR_IN_OUT instead." - .into(), - range: vec![location], - } - } - - pub fn overflow(message: String, location: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { message, range: vec![location], err_no: ErrNo::var__overflow } - } - - pub fn index_out_of_bounds(range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { - message: "Index out of bounds.".into(), - range: vec![range], - err_no: ErrNo::vla__dimension_idx_out_of_bounds, - } - } - - pub fn enum_variant_mismatch(enum_type: &str, range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { - message: format!("Assigned value is not a variant of {enum_type}"), - range: vec![range], - err_no: ErrNo::var__invalid_enum_variant, - } - } - - pub fn assignment_instead_of_equal(lhs: &str, rhs: &str, statement: &AstNode) -> Diagnostic { - Diagnostic::ImprovementSuggestion { - message: format!("This equal statement has no effect, did you mean `{lhs} := {rhs}`?"), - range: vec![statement.get_location()], - } - } } // CFC related diagnostics impl Diagnostic { - pub fn empty_control_statement(range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { - message: "Control statement has no connection".to_string(), - range: vec![range], - err_no: ErrNo::cfc__empty_control_statement, - } - } - - pub fn undefined_node(local_id: usize, ref_local_id: usize, range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { - message: format!("Node {local_id} is referencing a non-existing element with ID {ref_local_id}"), - range: vec![range], - err_no: ErrNo::cfc__undefined_node, - } - } - - pub fn unexpected_nodes(range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { - message: "Unexpected relationship between nodes".to_string(), - range: vec![range], - err_no: ErrNo::cfc__unexpected_node, - } - } - - pub fn unconnected_source(connector_name: &str, range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { - message: format!("Source '{connector_name}' is not connected."), - range: vec![range], - err_no: ErrNo::cfc__unconnected_source, - } - } - - pub fn sink_without_associated_source(connector_name: &str, range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { - message: format!("Expected a corresponding source-connection mark for sink '{connector_name}', but could not find one."), - range: vec![range], - err_no: ErrNo::cfc__no_associated_connector, - } - } - - pub fn cyclic_connection(message: String, range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { - message: format!("Sink is connected to itself. Found the following recursion: {message}"), - range: vec![range], - err_no: ErrNo::cfc__cyclic_connection, - } - } - - pub fn unnamed_control(range: SourceLocation) -> Diagnostic { - Diagnostic::SemanticError { - message: "Unnamed control".into(), - range: vec![range], - err_no: ErrNo::cfc__unnamed_control, - } - } - - pub fn invalid_build_description_file(message: String, location: Option) -> Diagnostic { - let range = if let Some(range) = location { vec![range] } else { vec![SourceLocation::internal()] }; - Diagnostic::SemanticError { message, range, err_no: ErrNo::plc_json__invalid } - } -} - -// Necessary in-between step to convert serde error to diagnostics, since there is -// a conflicting `From` impl for `Diagnostic` -impl From for SerdeError { - fn from(value: serde_json::Error) -> Self { - let line = value.line(); - let column = value.column(); - - // remove line, column from message - let message = value.to_string(); - let message = if let Some(pos) = message.find("at line") { - message.chars().take(pos).collect() - } else { - message - }; - - SerdeError { message, line, column } - } -} - -impl SerdeError { - pub fn into_diagnostic(self, src: &BuildDescriptionSource) -> Diagnostic { - let factory = SourceLocationFactory::for_source(src); - let range = factory.create_range_to_end_of_line(self.line, self.column); - - Diagnostic::invalid_build_description_file(self.message, Some(range)) + pub fn unnamed_control(location: SourceLocation) -> Diagnostic { + Diagnostic::error("Unnamed control").with_error_code("E087").with_location(location) } } @@ -849,7 +480,7 @@ impl SerdeError { mod tests { use codespan_reporting::files::{Location, SimpleFile}; - use crate::{diagnostician::Severity, reporter::clang::ClangFormatDiagnosticReporter}; + use crate::{diagnostics::Severity, reporter::clang::ClangFormatDiagnosticReporter}; #[test] fn test_build_diagnostic_msg() { diff --git a/compiler/plc_diagnostics/src/errno.rs b/compiler/plc_diagnostics/src/errno.rs deleted file mode 100644 index fb3feb2855..0000000000 --- a/compiler/plc_diagnostics/src/errno.rs +++ /dev/null @@ -1,116 +0,0 @@ -use std::fmt::Display; - -#[allow(non_camel_case_types)] -#[derive(PartialEq, Eq, Debug, Clone, Copy)] -pub enum ErrNo { - undefined, - - //general - general__err, - general__io_err, - general__param_err, - duplicate_symbol, - - //syntax - syntax__generic_error, - syntax__missing_token, - syntax__unexpected_token, - - //semantic - // pou related - pou__missing_return_type, - pou__unexpected_return_type, - pou__unsupported_return_type, - pou__empty_variable_block, - pou__missing_action_container, - pou__recursive_data_structure, - - // call - call__invalid_parameter_type, - call__invalid_parameter_count, - - //variable related - var__unresolved_constant, - var__invalid_constant_block, - var__invalid_constant, - var__cannot_assign_to_const, - var__invalid_assignment, - var__missing_type, - var__assigning_to_var_input_ref, - var__overflow, - var__invalid_enum_variant, - - //array related - arr__invalid_array_assignment, - - // VLA related - vla__invalid_container, - vla__invalid_array_access, - vla__dimension_idx_out_of_bounds, - - //reference related - reference__unresolved, - reference__illegal_access, - reference__expected, - - //type related - type__cast_error, - type__unknown_type, - type__invalid_type, - type__literal_out_of_range, - type__incompatible_literal_cast, - type__incompatible_directaccess, - type__incompatible_directaccess_variable, - type__incompatible_directaccess_range, - type__incompatible_arrayaccess_range, - type__incompatible_arrayaccess_variable, - type__incompatible_arrayaccess_type, - type__expected_literal, - type__invalid_nature, - type__unknown_nature, - type__unresolved_generic, - type__incompatible_size, - type__invalid_operation, - type__invalid_name, - - //codegen related - codegen__general, - codegen__missing_function, - codegen__missing_compare_function, - - //Debug code - debug_general, - //linker - linker__generic_error, - - //switch case - case__duplicate_condition, - case__case_condition_outside_case_statement, - case__invalid_case_condition, - - // CFC related - cfc__empty_control_statement, - cfc__undefined_node, - cfc__unexpected_node, - cfc__unconnected_source, - cfc__cyclic_connection, - cfc__no_associated_connector, - cfc__unnamed_control, - - // Project description file - plc_json__invalid, -} - -impl Display for ErrNo { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let desc = match self { - Self::general__err => "General Error".into(), - Self::codegen__general => "Codegen Error".into(), - Self::codegen__missing_compare_function => "Codegen Error: No compare function".into(), - Self::codegen__missing_function => "Codegen Error: Missing Function".into(), - _ => format!("{self:#?}"), - }; - - write!(f, "{desc}") - } -} diff --git a/compiler/plc_diagnostics/src/error_codes/E001.md b/compiler/plc_diagnostics/src/error_codes/E001.md new file mode 100644 index 0000000000..c010a25da2 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E001.md @@ -0,0 +1,4 @@ +# General Error + +This error is a catch all error. It is usually thrown when no other error better matches the case. + diff --git a/compiler/plc_diagnostics/src/error_codes/E002.md b/compiler/plc_diagnostics/src/error_codes/E002.md new file mode 100644 index 0000000000..fb2def7138 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E002.md @@ -0,0 +1,4 @@ +# General IO Error + +This error describes a problem during an IO operation such as reading or writing a file. +It is usually accompanied by an internal error with further details. diff --git a/compiler/plc_diagnostics/src/error_codes/E003.md b/compiler/plc_diagnostics/src/error_codes/E003.md new file mode 100644 index 0000000000..d4a295dd16 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E003.md @@ -0,0 +1,3 @@ +# Parameter Error + +This error describes a problem with the command parameters, such as a file required for the compilation not being found.: diff --git a/compiler/plc_diagnostics/src/error_codes/E004.md b/compiler/plc_diagnostics/src/error_codes/E004.md new file mode 100644 index 0000000000..9656ac87dd --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E004.md @@ -0,0 +1,3 @@ +# Duplicate Symbol + +The marked symbol has been fined multiple times. diff --git a/compiler/plc_diagnostics/src/error_codes/E005.md b/compiler/plc_diagnostics/src/error_codes/E005.md new file mode 100644 index 0000000000..f29cb607d7 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E005.md @@ -0,0 +1,5 @@ +# Generic LLVM Error + +An unexpected error occurred during the LLVM generation phase. +This is usually a follow up problem from a different diagnostics. +If it occurrs without a previous diagnostics please file a bug report. diff --git a/compiler/plc_diagnostics/src/error_codes/E006.md b/compiler/plc_diagnostics/src/error_codes/E006.md new file mode 100644 index 0000000000..27a21e496c --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E006.md @@ -0,0 +1,19 @@ +# Missing Token + +During the parsing phase, an additional _Token_ (Element) was required to correctly interpret the code. +The error message usually indicates what Token was missing. + +## Example +In the following example the name (Identifier) of the program is missing. +```iecst +PROGRAM (*name*) +END_PROGRAM +``` + +``` +error: Unexpected token: expected Identifier but found END_PROGRAM + ┌─ example.st:2:1 + │ +2 │ END_PROGRAM + │ ^^^^^^^^^^^ Unexpected token: expected Identifier but found END_PROGRAM +``` diff --git a/compiler/plc_diagnostics/src/error_codes/E007.md b/compiler/plc_diagnostics/src/error_codes/E007.md new file mode 100644 index 0000000000..9069784582 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E007.md @@ -0,0 +1,3 @@ +# Unexpected Token + +During parsing, a _Token_ (Element) was encountered in the wrong location. This could be an indication of a missused or misspelled keyword diff --git a/compiler/plc_diagnostics/src/error_codes/E008.md b/compiler/plc_diagnostics/src/error_codes/E008.md new file mode 100644 index 0000000000..53c8bffd03 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E008.md @@ -0,0 +1 @@ +# Invalid Range diff --git a/compiler/plc_diagnostics/src/error_codes/E009.md b/compiler/plc_diagnostics/src/error_codes/E009.md new file mode 100644 index 0000000000..3da23c4e62 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E009.md @@ -0,0 +1 @@ +# Mismatched Parantheses diff --git a/compiler/plc_diagnostics/src/error_codes/E010.md b/compiler/plc_diagnostics/src/error_codes/E010.md new file mode 100644 index 0000000000..e6352a85dd --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E010.md @@ -0,0 +1 @@ +# Invalid time literal diff --git a/compiler/plc_diagnostics/src/error_codes/E011.md b/compiler/plc_diagnostics/src/error_codes/E011.md new file mode 100644 index 0000000000..d7043d3263 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E011.md @@ -0,0 +1 @@ +# Invalid Number diff --git a/compiler/plc_diagnostics/src/error_codes/E012.md b/compiler/plc_diagnostics/src/error_codes/E012.md new file mode 100644 index 0000000000..a90532e3ff --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E012.md @@ -0,0 +1 @@ +# Missing Case Contition diff --git a/compiler/plc_diagnostics/src/error_codes/E013.md b/compiler/plc_diagnostics/src/error_codes/E013.md new file mode 100644 index 0000000000..f957fea2bf --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E013.md @@ -0,0 +1 @@ +# Keywords should contain Underscores diff --git a/compiler/plc_diagnostics/src/error_codes/E014.md b/compiler/plc_diagnostics/src/error_codes/E014.md new file mode 100644 index 0000000000..fd46767ea8 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E014.md @@ -0,0 +1 @@ +# Wrong paranthese for String delimiter diff --git a/compiler/plc_diagnostics/src/error_codes/E015.md b/compiler/plc_diagnostics/src/error_codes/E015.md new file mode 100644 index 0000000000..e61f30f5e5 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E015.md @@ -0,0 +1 @@ +# POINTER_TO is no standard keyword diff --git a/compiler/plc_diagnostics/src/error_codes/E016.md b/compiler/plc_diagnostics/src/error_codes/E016.md new file mode 100644 index 0000000000..fd7301c856 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E016.md @@ -0,0 +1 @@ + # Return types cannot have a default value diff --git a/compiler/plc_diagnostics/src/error_codes/E017.md b/compiler/plc_diagnostics/src/error_codes/E017.md new file mode 100644 index 0000000000..62cd545526 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E017.md @@ -0,0 +1 @@ +# Classes cannot contain implementation diff --git a/compiler/plc_diagnostics/src/error_codes/E018.md b/compiler/plc_diagnostics/src/error_codes/E018.md new file mode 100644 index 0000000000..a1137a2d0b --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E018.md @@ -0,0 +1 @@ +# Duplicate Label diff --git a/compiler/plc_diagnostics/src/error_codes/E019.md b/compiler/plc_diagnostics/src/error_codes/E019.md new file mode 100644 index 0000000000..2812779e26 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E019.md @@ -0,0 +1 @@ +# Classes cannot contain IN_OUT variables diff --git a/compiler/plc_diagnostics/src/error_codes/E020.md b/compiler/plc_diagnostics/src/error_codes/E020.md new file mode 100644 index 0000000000..3b27c61b1e --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E020.md @@ -0,0 +1 @@ +# Classes cannot contain a return type diff --git a/compiler/plc_diagnostics/src/error_codes/E021.md b/compiler/plc_diagnostics/src/error_codes/E021.md new file mode 100644 index 0000000000..8ccd6c6e40 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E021.md @@ -0,0 +1 @@ +# POUs cannot be extended diff --git a/compiler/plc_diagnostics/src/error_codes/E022.md b/compiler/plc_diagnostics/src/error_codes/E022.md new file mode 100644 index 0000000000..657273fcc8 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E022.md @@ -0,0 +1 @@ +# Missing container name for action diff --git a/compiler/plc_diagnostics/src/error_codes/E023.md b/compiler/plc_diagnostics/src/error_codes/E023.md new file mode 100644 index 0000000000..003b73a8d9 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E023.md @@ -0,0 +1 @@ +# Statement has no effect diff --git a/compiler/plc_diagnostics/src/error_codes/E024.md b/compiler/plc_diagnostics/src/error_codes/E024.md new file mode 100644 index 0000000000..7e03ef81ee --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E024.md @@ -0,0 +1 @@ +# Invalid Pragma Location diff --git a/compiler/plc_diagnostics/src/error_codes/E025.md b/compiler/plc_diagnostics/src/error_codes/E025.md new file mode 100644 index 0000000000..f095e4ac2b --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E025.md @@ -0,0 +1 @@ +# Missing return type diff --git a/compiler/plc_diagnostics/src/error_codes/E026.md b/compiler/plc_diagnostics/src/error_codes/E026.md new file mode 100644 index 0000000000..e6bab3759c --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E026.md @@ -0,0 +1 @@ +# Unexpected return type diff --git a/compiler/plc_diagnostics/src/error_codes/E027.md b/compiler/plc_diagnostics/src/error_codes/E027.md new file mode 100644 index 0000000000..f647d36a50 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E027.md @@ -0,0 +1 @@ +# Unsupported return type diff --git a/compiler/plc_diagnostics/src/error_codes/E028.md b/compiler/plc_diagnostics/src/error_codes/E028.md new file mode 100644 index 0000000000..4be8770898 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E028.md @@ -0,0 +1 @@ +# Empty variable block diff --git a/compiler/plc_diagnostics/src/error_codes/E029.md b/compiler/plc_diagnostics/src/error_codes/E029.md new file mode 100644 index 0000000000..0260dbc1c0 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E029.md @@ -0,0 +1 @@ +# Recursive data structure diff --git a/compiler/plc_diagnostics/src/error_codes/E030.md b/compiler/plc_diagnostics/src/error_codes/E030.md new file mode 100644 index 0000000000..72923532ae --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E030.md @@ -0,0 +1 @@ +# Missing IN_OUT parameters diff --git a/compiler/plc_diagnostics/src/error_codes/E031.md b/compiler/plc_diagnostics/src/error_codes/E031.md new file mode 100644 index 0000000000..1acb7ec21e --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E031.md @@ -0,0 +1 @@ +# Invalid parameter type diff --git a/compiler/plc_diagnostics/src/error_codes/E032.md b/compiler/plc_diagnostics/src/error_codes/E032.md new file mode 100644 index 0000000000..53e170129c --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E032.md @@ -0,0 +1 @@ +# Invalid number of parameters diff --git a/compiler/plc_diagnostics/src/error_codes/E033.md b/compiler/plc_diagnostics/src/error_codes/E033.md new file mode 100644 index 0000000000..dc98ed2de4 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E033.md @@ -0,0 +1 @@ +# Unresolved Constant diff --git a/compiler/plc_diagnostics/src/error_codes/E034.md b/compiler/plc_diagnostics/src/error_codes/E034.md new file mode 100644 index 0000000000..71eb7574e8 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E034.md @@ -0,0 +1 @@ +# Invalid constant block diff --git a/compiler/plc_diagnostics/src/error_codes/E035.md b/compiler/plc_diagnostics/src/error_codes/E035.md new file mode 100644 index 0000000000..ee386e19ac --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E035.md @@ -0,0 +1 @@ +# Invalid Constant diff --git a/compiler/plc_diagnostics/src/error_codes/E036.md b/compiler/plc_diagnostics/src/error_codes/E036.md new file mode 100644 index 0000000000..7be474d364 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E036.md @@ -0,0 +1 @@ +# Cannot assign to constant diff --git a/compiler/plc_diagnostics/src/error_codes/E037.md b/compiler/plc_diagnostics/src/error_codes/E037.md new file mode 100644 index 0000000000..d6ff1531d6 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E037.md @@ -0,0 +1 @@ +# Invalid assignment diff --git a/compiler/plc_diagnostics/src/error_codes/E038.md b/compiler/plc_diagnostics/src/error_codes/E038.md new file mode 100644 index 0000000000..d979f608d6 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E038.md @@ -0,0 +1 @@ +# Missing type diff --git a/compiler/plc_diagnostics/src/error_codes/E039.md b/compiler/plc_diagnostics/src/error_codes/E039.md new file mode 100644 index 0000000000..8dcd3856f1 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E039.md @@ -0,0 +1 @@ +# Variable Overflow diff --git a/compiler/plc_diagnostics/src/error_codes/E040.md b/compiler/plc_diagnostics/src/error_codes/E040.md new file mode 100644 index 0000000000..cefb8230f9 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E040.md @@ -0,0 +1 @@ +# Invalid Enum Variant diff --git a/compiler/plc_diagnostics/src/error_codes/E041.md b/compiler/plc_diagnostics/src/error_codes/E041.md new file mode 100644 index 0000000000..520fb33a23 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E041.md @@ -0,0 +1 @@ +# Invalid variable initializer diff --git a/compiler/plc_diagnostics/src/error_codes/E042.md b/compiler/plc_diagnostics/src/error_codes/E042.md new file mode 100644 index 0000000000..6df0834f94 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E042.md @@ -0,0 +1 @@ +# Assignment to Reference diff --git a/compiler/plc_diagnostics/src/error_codes/E043.md b/compiler/plc_diagnostics/src/error_codes/E043.md new file mode 100644 index 0000000000..5fee770d8a --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E043.md @@ -0,0 +1 @@ +# Invalid array assignment diff --git a/compiler/plc_diagnostics/src/error_codes/E044.md b/compiler/plc_diagnostics/src/error_codes/E044.md new file mode 100644 index 0000000000..aec7a75799 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E044.md @@ -0,0 +1 @@ +# Invalid POU for VLA diff --git a/compiler/plc_diagnostics/src/error_codes/E045.md b/compiler/plc_diagnostics/src/error_codes/E045.md new file mode 100644 index 0000000000..c9368a1b9b --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E045.md @@ -0,0 +1 @@ +# Invalid VLA array access diff --git a/compiler/plc_diagnostics/src/error_codes/E046.md b/compiler/plc_diagnostics/src/error_codes/E046.md new file mode 100644 index 0000000000..e331bf8924 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E046.md @@ -0,0 +1 @@ +# VLA Dimension out of bounds diff --git a/compiler/plc_diagnostics/src/error_codes/E047.md b/compiler/plc_diagnostics/src/error_codes/E047.md new file mode 100644 index 0000000000..af2ec98f30 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E047.md @@ -0,0 +1 @@ +# VLAs are always By Reference diff --git a/compiler/plc_diagnostics/src/error_codes/E048.md b/compiler/plc_diagnostics/src/error_codes/E048.md new file mode 100644 index 0000000000..7ecd643be0 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E048.md @@ -0,0 +1 @@ +# Unresolved Reference diff --git a/compiler/plc_diagnostics/src/error_codes/E049.md b/compiler/plc_diagnostics/src/error_codes/E049.md new file mode 100644 index 0000000000..65312f0a06 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E049.md @@ -0,0 +1 @@ +# Illegal reference access diff --git a/compiler/plc_diagnostics/src/error_codes/E050.md b/compiler/plc_diagnostics/src/error_codes/E050.md new file mode 100644 index 0000000000..7a7023749b --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E050.md @@ -0,0 +1 @@ +# Expression is not assignable diff --git a/compiler/plc_diagnostics/src/error_codes/E051.md b/compiler/plc_diagnostics/src/error_codes/E051.md new file mode 100644 index 0000000000..62538fb2e6 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E051.md @@ -0,0 +1 @@ +# Typecast error diff --git a/compiler/plc_diagnostics/src/error_codes/E052.md b/compiler/plc_diagnostics/src/error_codes/E052.md new file mode 100644 index 0000000000..16bf0e4566 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E052.md @@ -0,0 +1 @@ +# Unknown type diff --git a/compiler/plc_diagnostics/src/error_codes/E053.md b/compiler/plc_diagnostics/src/error_codes/E053.md new file mode 100644 index 0000000000..55a79bcdbb --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E053.md @@ -0,0 +1 @@ +# Literal out of range diff --git a/compiler/plc_diagnostics/src/error_codes/E054.md b/compiler/plc_diagnostics/src/error_codes/E054.md new file mode 100644 index 0000000000..acc1f2bca4 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E054.md @@ -0,0 +1 @@ +# Literal not compatible with type diff --git a/compiler/plc_diagnostics/src/error_codes/E055.md b/compiler/plc_diagnostics/src/error_codes/E055.md new file mode 100644 index 0000000000..74684ca10f --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E055.md @@ -0,0 +1 @@ +# Incompatible direct access diff --git a/compiler/plc_diagnostics/src/error_codes/E056.md b/compiler/plc_diagnostics/src/error_codes/E056.md new file mode 100644 index 0000000000..367481fbed --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E056.md @@ -0,0 +1 @@ +# Incompatible variable for direct access diff --git a/compiler/plc_diagnostics/src/error_codes/E057.md b/compiler/plc_diagnostics/src/error_codes/E057.md new file mode 100644 index 0000000000..e8db71a949 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E057.md @@ -0,0 +1 @@ +# Invalid range for direct access diff --git a/compiler/plc_diagnostics/src/error_codes/E058.md b/compiler/plc_diagnostics/src/error_codes/E058.md new file mode 100644 index 0000000000..bbae76aa55 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E058.md @@ -0,0 +1 @@ +# Invalid range for array access diff --git a/compiler/plc_diagnostics/src/error_codes/E059.md b/compiler/plc_diagnostics/src/error_codes/E059.md new file mode 100644 index 0000000000..2c984e606a --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E059.md @@ -0,0 +1 @@ +# Invalid variable for array access diff --git a/compiler/plc_diagnostics/src/error_codes/E060.md b/compiler/plc_diagnostics/src/error_codes/E060.md new file mode 100644 index 0000000000..7d57b5f349 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E060.md @@ -0,0 +1 @@ +# Direct access to variable with % diff --git a/compiler/plc_diagnostics/src/error_codes/E061.md b/compiler/plc_diagnostics/src/error_codes/E061.md new file mode 100644 index 0000000000..711b6b17ba --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E061.md @@ -0,0 +1 @@ +# Expected literal diff --git a/compiler/plc_diagnostics/src/error_codes/E062.md b/compiler/plc_diagnostics/src/error_codes/E062.md new file mode 100644 index 0000000000..5c748fcf0a --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E062.md @@ -0,0 +1 @@ +# Invalid Nature diff --git a/compiler/plc_diagnostics/src/error_codes/E063.md b/compiler/plc_diagnostics/src/error_codes/E063.md new file mode 100644 index 0000000000..8d0d637f8e --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E063.md @@ -0,0 +1 @@ +# Unknown Nature diff --git a/compiler/plc_diagnostics/src/error_codes/E064.md b/compiler/plc_diagnostics/src/error_codes/E064.md new file mode 100644 index 0000000000..872747b32c --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E064.md @@ -0,0 +1 @@ +# Unresolved Generic diff --git a/compiler/plc_diagnostics/src/error_codes/E065.md b/compiler/plc_diagnostics/src/error_codes/E065.md new file mode 100644 index 0000000000..887b315ba7 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E065.md @@ -0,0 +1 @@ +# Incompatible size diff --git a/compiler/plc_diagnostics/src/error_codes/E066.md b/compiler/plc_diagnostics/src/error_codes/E066.md new file mode 100644 index 0000000000..bbf0ab5f23 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E066.md @@ -0,0 +1 @@ +# Invalid operation diff --git a/compiler/plc_diagnostics/src/error_codes/E067.md b/compiler/plc_diagnostics/src/error_codes/E067.md new file mode 100644 index 0000000000..9de4484101 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E067.md @@ -0,0 +1 @@ +# Implicit typecast diff --git a/compiler/plc_diagnostics/src/error_codes/E068.md b/compiler/plc_diagnostics/src/error_codes/E068.md new file mode 100644 index 0000000000..6237f8d9c8 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E068.md @@ -0,0 +1 @@ +# Pointer derefernce to non pointer diff --git a/compiler/plc_diagnostics/src/error_codes/E069.md b/compiler/plc_diagnostics/src/error_codes/E069.md new file mode 100644 index 0000000000..70c02a3106 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E069.md @@ -0,0 +1 @@ +# Array access to non array value diff --git a/compiler/plc_diagnostics/src/error_codes/E070.md b/compiler/plc_diagnostics/src/error_codes/E070.md new file mode 100644 index 0000000000..7ef902c1a1 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E070.md @@ -0,0 +1 @@ +# Address-of requires a value diff --git a/compiler/plc_diagnostics/src/error_codes/E071.md b/compiler/plc_diagnostics/src/error_codes/E071.md new file mode 100644 index 0000000000..4f4fd03144 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E071.md @@ -0,0 +1 @@ +# General codegen error diff --git a/compiler/plc_diagnostics/src/error_codes/E072.md b/compiler/plc_diagnostics/src/error_codes/E072.md new file mode 100644 index 0000000000..38d28e4af6 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E072.md @@ -0,0 +1 @@ +# Missing function diff --git a/compiler/plc_diagnostics/src/error_codes/E073.md b/compiler/plc_diagnostics/src/error_codes/E073.md new file mode 100644 index 0000000000..4513f270fc --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E073.md @@ -0,0 +1 @@ +# Missing compare function diff --git a/compiler/plc_diagnostics/src/error_codes/E074.md b/compiler/plc_diagnostics/src/error_codes/E074.md new file mode 100644 index 0000000000..2cbc355f58 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E074.md @@ -0,0 +1 @@ +# Cannot generate string literal diff --git a/compiler/plc_diagnostics/src/error_codes/E075.md b/compiler/plc_diagnostics/src/error_codes/E075.md new file mode 100644 index 0000000000..6893403de3 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E075.md @@ -0,0 +1 @@ +# Initial values were not generate diff --git a/compiler/plc_diagnostics/src/error_codes/E076.md b/compiler/plc_diagnostics/src/error_codes/E076.md new file mode 100644 index 0000000000..e4137a1ff0 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E076.md @@ -0,0 +1 @@ +# General debug error diff --git a/compiler/plc_diagnostics/src/error_codes/E077.md b/compiler/plc_diagnostics/src/error_codes/E077.md new file mode 100644 index 0000000000..864b9e3282 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E077.md @@ -0,0 +1 @@ +# Generic linker error diff --git a/compiler/plc_diagnostics/src/error_codes/E078.md b/compiler/plc_diagnostics/src/error_codes/E078.md new file mode 100644 index 0000000000..a56e161151 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E078.md @@ -0,0 +1 @@ +# Duplicate case condition diff --git a/compiler/plc_diagnostics/src/error_codes/E079.md b/compiler/plc_diagnostics/src/error_codes/E079.md new file mode 100644 index 0000000000..658fb5ec86 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E079.md @@ -0,0 +1 @@ +# Case condition outside of a case statement diff --git a/compiler/plc_diagnostics/src/error_codes/E080.md b/compiler/plc_diagnostics/src/error_codes/E080.md new file mode 100644 index 0000000000..af75ff7d54 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E080.md @@ -0,0 +1 @@ +# Invalid case condition diff --git a/compiler/plc_diagnostics/src/error_codes/E081.md b/compiler/plc_diagnostics/src/error_codes/E081.md new file mode 100644 index 0000000000..00fe97c2f7 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E081.md @@ -0,0 +1 @@ +# Empty control statement diff --git a/compiler/plc_diagnostics/src/error_codes/E082.md b/compiler/plc_diagnostics/src/error_codes/E082.md new file mode 100644 index 0000000000..ce16173736 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E082.md @@ -0,0 +1 @@ +# Undefined node diff --git a/compiler/plc_diagnostics/src/error_codes/E083.md b/compiler/plc_diagnostics/src/error_codes/E083.md new file mode 100644 index 0000000000..2155d9d6f1 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E083.md @@ -0,0 +1 @@ +# Unexpected node diff --git a/compiler/plc_diagnostics/src/error_codes/E084.md b/compiler/plc_diagnostics/src/error_codes/E084.md new file mode 100644 index 0000000000..c9303fba0a --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E084.md @@ -0,0 +1 @@ +# Unconnected source diff --git a/compiler/plc_diagnostics/src/error_codes/E085.md b/compiler/plc_diagnostics/src/error_codes/E085.md new file mode 100644 index 0000000000..fcf58e6273 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E085.md @@ -0,0 +1 @@ +# Cyclic connection diff --git a/compiler/plc_diagnostics/src/error_codes/E086.md b/compiler/plc_diagnostics/src/error_codes/E086.md new file mode 100644 index 0000000000..f731d5630e --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E086.md @@ -0,0 +1 @@ +# No associated connector diff --git a/compiler/plc_diagnostics/src/error_codes/E087.md b/compiler/plc_diagnostics/src/error_codes/E087.md new file mode 100644 index 0000000000..d54df4626b --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E087.md @@ -0,0 +1 @@ +# Unnamed control diff --git a/compiler/plc_diagnostics/src/error_codes/E088.md b/compiler/plc_diagnostics/src/error_codes/E088.md new file mode 100644 index 0000000000..bdae3b4fae --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E088.md @@ -0,0 +1 @@ +# Invalid PLC Json file diff --git a/compiler/plc_diagnostics/src/error_codes/E089.md b/compiler/plc_diagnostics/src/error_codes/E089.md new file mode 100644 index 0000000000..480108cbcf --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E089.md @@ -0,0 +1 @@ +# Invalid Call parameters \ No newline at end of file diff --git a/compiler/plc_diagnostics/src/error_codes/E090.md b/compiler/plc_diagnostics/src/error_codes/E090.md new file mode 100644 index 0000000000..43afd815f9 --- /dev/null +++ b/compiler/plc_diagnostics/src/error_codes/E090.md @@ -0,0 +1 @@ +# Incompatible reference assingment diff --git a/compiler/plc_diagnostics/src/lib.rs b/compiler/plc_diagnostics/src/lib.rs index 3a17b793a9..69c8ab2e15 100644 --- a/compiler/plc_diagnostics/src/lib.rs +++ b/compiler/plc_diagnostics/src/lib.rs @@ -2,5 +2,4 @@ pub mod diagnostician; pub mod diagnostics; -pub mod errno; // TODO: Make this crate-private? pub mod reporter; diff --git a/compiler/plc_diagnostics/src/reporter.rs b/compiler/plc_diagnostics/src/reporter.rs index 7735c775b7..6bcb7b35e1 100644 --- a/compiler/plc_diagnostics/src/reporter.rs +++ b/compiler/plc_diagnostics/src/reporter.rs @@ -1,6 +1,6 @@ use plc_source::source_location::CodeSpan; -use crate::diagnostician::Severity; +use crate::diagnostics::Severity; pub mod clang; pub mod codespan; diff --git a/compiler/plc_diagnostics/src/reporter/clang.rs b/compiler/plc_diagnostics/src/reporter/clang.rs index cd56870ee7..9b7c178b18 100644 --- a/compiler/plc_diagnostics/src/reporter/clang.rs +++ b/compiler/plc_diagnostics/src/reporter/clang.rs @@ -1,6 +1,6 @@ use codespan_reporting::files::{Files, Location, SimpleFile, SimpleFiles}; -use crate::diagnostician::Severity; +use crate::diagnostics::Severity; use super::{DiagnosticReporter, ResolvedDiagnostics}; diff --git a/compiler/plc_diagnostics/src/reporter/codespan.rs b/compiler/plc_diagnostics/src/reporter/codespan.rs index 34f3c2a0bd..201d32ca43 100644 --- a/compiler/plc_diagnostics/src/reporter/codespan.rs +++ b/compiler/plc_diagnostics/src/reporter/codespan.rs @@ -5,7 +5,7 @@ use codespan_reporting::{ }; use plc_source::source_location::CodeSpan; -use crate::diagnostician::Severity; +use crate::diagnostics::Severity; use super::{DiagnosticReporter, ResolvedDiagnostics}; @@ -100,7 +100,7 @@ impl DiagnosticReporter for CodeSpanDiagnosticReporter { fn report(&mut self, diagnostics: &[ResolvedDiagnostics]) { for d in diagnostics { let diagnostic_factory = match d.severity { - Severity::Critical | Severity::Error => codespan_reporting::diagnostic::Diagnostic::error(), + Severity::Error => codespan_reporting::diagnostic::Diagnostic::error(), Severity::Warning => codespan_reporting::diagnostic::Diagnostic::warning(), Severity::Info => codespan_reporting::diagnostic::Diagnostic::note(), }; diff --git a/compiler/plc_driver/Cargo.toml b/compiler/plc_driver/Cargo.toml index c1ece9a6ee..743087961a 100644 --- a/compiler/plc_driver/Cargo.toml +++ b/compiler/plc_driver/Cargo.toml @@ -24,6 +24,7 @@ env_logger = "0.10" log.workspace = true encoding_rs.workspace = true encoding_rs_io.workspace = true +anyhow.workspace = true [dev-dependencies] pretty_assertions = "1.3.0" diff --git a/compiler/plc_driver/src/lib.rs b/compiler/plc_driver/src/lib.rs index 8968f52b65..13914421eb 100644 --- a/compiler/plc_driver/src/lib.rs +++ b/compiler/plc_driver/src/lib.rs @@ -8,6 +8,7 @@ //! - Shared Objects //! - Executables +use anyhow::Result; use std::{ env, ffi::OsStr, @@ -118,7 +119,7 @@ impl Display for CompileError { } } -pub fn compile + AsRef + Debug>(args: &[T]) -> Result<(), CompileError> { +pub fn compile + AsRef + Debug>(args: &[T]) -> Result<()> { //Parse the arguments let compile_parameters = CompileParameters::parse(args)?; let project = get_project(&compile_parameters)?; @@ -195,11 +196,9 @@ pub fn compile + AsRef + Debug>(args: &[T]) -> Result<(), C .map_err(|err| Diagnostic::codegen_error(err.get_message(), err.get_location())); if let Err(res) = res { diagnostician.handle(&[res]); - return Err(Diagnostic::GeneralError { - message: "Compilation aborted due to previous errors".into(), - err_no: plc_diagnostics::errno::ErrNo::codegen__general, - } - .into()); + return Err(Diagnostic::error("Compilation aborted due to previous errors") + .with_error_code("E071") + .into()); } } @@ -251,10 +250,7 @@ fn generate_to_string_internal( } let module = project.generate_single_module(&context, &options)?; - module.map(|it| it.persist_to_string()).ok_or_else(|| Diagnostic::GeneralError { - message: "Cannot generate module".to_string(), - err_no: plc_diagnostics::errno::ErrNo::general__err, - }) + module.map(|it| it.persist_to_string()).ok_or_else(|| Diagnostic::error("Cannot generate module")) } fn generate( @@ -328,7 +324,7 @@ fn generate( Ok(()) } -fn get_project(compile_parameters: &CompileParameters) -> Result, Diagnostic> { +fn get_project(compile_parameters: &CompileParameters) -> Result> { let current_dir = env::current_dir()?; //Create a project from either the subcommand or single params let project = if let Some(command) = &compile_parameters.commands { @@ -345,7 +341,7 @@ fn get_project(compile_parameters: &CompileParameters) -> Result Result<()> { //Initialize the logging env_logger::init(); let args: Vec = env::args().collect(); - if let Err(err) = plc_driver::compile(&args) { - err.exit() - } + plc_driver::compile(&args) } diff --git a/compiler/plc_driver/src/pipelines.rs b/compiler/plc_driver/src/pipelines.rs index 1ef53cb4c0..fb4414192f 100644 --- a/compiler/plc_driver/src/pipelines.rs +++ b/compiler/plc_driver/src/pipelines.rs @@ -21,9 +21,8 @@ use plc::{ ConfigFormat, Target, }; use plc_diagnostics::{ - diagnostician::{Diagnostician, Severity}, - diagnostics::Diagnostic, - errno::ErrNo, + diagnostician::Diagnostician, + diagnostics::{Diagnostic, Severity}, }; use plc_index::GlobalContext; use project::{ @@ -194,11 +193,8 @@ impl AnnotatedProject { let diagnostics = validator.diagnostics(); severity = severity.max(diagnostician.handle(&diagnostics)); }); - if severity == Severity::Critical { - Err(Diagnostic::GeneralError { - message: "Compilation aborted due to critical errors".into(), - err_no: ErrNo::general__err, - }) + if severity == Severity::Error { + Err(Diagnostic::error("Compilation aborted due to critical errors")) } else { Ok(()) } @@ -318,7 +314,13 @@ impl AnnotatedProject { let unit_location = PathBuf::from(&unit.file_name); let unit_location = std::fs::canonicalize(unit_location)?; let output_name = if unit_location.starts_with(current_dir) { - unit_location.strip_prefix(current_dir)? + unit_location.strip_prefix(current_dir).map_err(|it| { + Diagnostic::error(format!( + "Could not strip prefix for {}", + current_dir.to_string_lossy() + )) + .with_internal_error(it.into()) + })? } else if unit_location.has_root() { let root = Path::new("/").canonicalize()?; unit_location.strip_prefix(root).expect("Name has root") @@ -364,7 +366,7 @@ impl AnnotatedProject { let hw_conf = plc::hardware_binding::collect_hardware_configuration(&self.index)?; let generated_conf = plc::hardware_binding::generate_hardware_configuration(&hw_conf, format)?; File::create(location).and_then(|mut it| it.write_all(generated_conf.as_bytes())).map_err(|it| { - Diagnostic::GeneralError { err_no: ErrNo::general__io_err, message: it.to_string() } + Diagnostic::error(it.to_string()).with_internal_error(it.into()).with_error_code("E002") })?; Ok(()) } @@ -450,7 +452,7 @@ impl GeneratedProject { // Only initialize a linker if we need to use it let target_triple = self.target.get_target_triple(); let mut linker = plc::linker::Linker::new( - target_triple.as_str().to_str()?, + &target_triple.as_str().to_string_lossy(), link_options.linker.as_deref(), )?; for obj in &self.objects { diff --git a/compiler/plc_driver/src/tests/external_files.rs b/compiler/plc_driver/src/tests/external_files.rs index 82634939ee..d94ca4d2f3 100644 --- a/compiler/plc_driver/src/tests/external_files.rs +++ b/compiler/plc_driver/src/tests/external_files.rs @@ -1,6 +1,5 @@ use plc::DebugLevel; -use plc_diagnostics::diagnostics::Diagnostic; -use source_code::{source_location::SourceLocationFactory, SourceCode}; +use source_code::SourceCode; use crate::tests::compile_to_string; @@ -74,17 +73,10 @@ fn calling_external_file_function_without_including_file_results_in_error() { "external_file.st", ); //External file is not included - let source_location_factory = SourceLocationFactory::for_source(&prog); let res = compile_to_string(vec![prog], vec![], None, DebugLevel::None); if let Err(msg) = res { - assert_eq!( - Diagnostic::codegen_error( - r#"cannot generate call statement for "ReferenceExpr { kind: Member(Identifier { name: \"external\" }), base: None }""#, - source_location_factory.create_range(33..41) - ), - msg - ) + insta::assert_snapshot!(msg.to_string()) } else { panic!("expected code-gen error but got none") } diff --git a/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__external_files__calling_external_file_function_without_including_file_results_in_error.snap b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__external_files__calling_external_file_function_without_including_file_results_in_error.snap new file mode 100644 index 0000000000..89abfadca5 --- /dev/null +++ b/compiler/plc_driver/src/tests/snapshots/plc_driver__tests__external_files__calling_external_file_function_without_including_file_results_in_error.snap @@ -0,0 +1,5 @@ +--- +source: compiler/plc_driver/./src/tests/external_files.rs +expression: msg.to_string() +--- +E071: cannot generate call statement for ReferenceExpr { kind: Member(Identifier { name: "external" }), base: None } at: external_file.st:2:8:{2:8-2:16}: diff --git a/compiler/plc_index/src/lib.rs b/compiler/plc_index/src/lib.rs index 6db52c4a48..c0ace21353 100644 --- a/compiler/plc_index/src/lib.rs +++ b/compiler/plc_index/src/lib.rs @@ -34,7 +34,14 @@ impl GlobalContext { { match container.load_source(encoding) { Ok(value) => self.sources.insert(container.get_location_str(), value), - Err(why) => return Err(Diagnostic::io_read_error(container.get_location_str(), &why)), + Err(why) => { + return Err(Diagnostic::error(format!( + "Cannot read file '{}': {}'", + container.get_location_str(), + &why + )) + .with_error_code("E002")) + } }; Ok(()) @@ -66,13 +73,13 @@ impl GlobalContext { /// Returns a (whitespace) trimmed slice representing the specified location of the source code. /// For example if the location represents `ARRAY[1..5]\n\nOF\t DINT` the slice `ARRAY[1..5] OF DINT` will be returned instead. pub fn slice(&self, location: &SourceLocation) -> String { - let slice = self.slice_original(location); + let slice = self.slice_raw(location); slice.split_whitespace().collect::>().join(" ") } /// Returns a slice representing the specified location of the source code. /// If the location, i.e. file path, does not exist an empty string will be returned. - pub fn slice_original(&self, location: &SourceLocation) -> &str { + pub fn slice_raw(&self, location: &SourceLocation) -> &str { let path = location.get_file_name().unwrap_or(""); let Some(code) = self.sources.get(path) else { return "" }; @@ -117,9 +124,6 @@ mod tests { let location = factory.create_range(0..input.source.len()); assert_eq!(ctxt.slice(&location), "ARRAY[1..5] OF DINT"); - assert_eq!( - ctxt.slice_original(&location), - "ARRAY[1..5] \n\n\n\nOF \n\n\n \t DINT" - ); + assert_eq!(ctxt.slice_raw(&location), "ARRAY[1..5] \n\n\n\nOF \n\n\n \t DINT"); } } diff --git a/compiler/plc_project/Cargo.toml b/compiler/plc_project/Cargo.toml index 5845fe8fba..0427b52975 100644 --- a/compiler/plc_project/Cargo.toml +++ b/compiler/plc_project/Cargo.toml @@ -16,6 +16,7 @@ jsonschema = "0.17" encoding_rs.workspace = true encoding_rs_io.workspace = true glob = "*" +anyhow.workspace = true [dev-dependencies] insta = "1.31.0" diff --git a/compiler/plc_project/src/build_config.rs b/compiler/plc_project/src/build_config.rs index 133325d4f7..63c0a1ee9f 100644 --- a/compiler/plc_project/src/build_config.rs +++ b/compiler/plc_project/src/build_config.rs @@ -1,7 +1,7 @@ +use anyhow::Result; use jsonschema::JSONSchema; use plc::Target; use plc_diagnostics::diagnostics::Diagnostic; -use plc_diagnostics::diagnostics::SerdeError; use regex::Captures; use regex::Regex; use serde::{Deserialize, Serialize}; @@ -63,19 +63,17 @@ pub struct ProjectConfig { impl ProjectConfig { /// Returns a project from the given json-source /// All environment variables (marked with `$VAR_NAME`) that can be resovled at this time are resolved before the conversion - pub fn try_parse(source: BuildDescriptionSource) -> Result { + pub fn try_parse(source: BuildDescriptionSource) -> Result { let content = source.source.as_str(); let content = resolve_environment_variables(content)?; - let config: ProjectConfig = serde_json::from_str(&content).map_err(|err| { - let err = SerdeError::from(err); - err.into_diagnostic(&source) - })?; + let config: ProjectConfig = + serde_json::from_str(&content).map_err(|err| Diagnostic::from_serde_error(err, &source))?; config.validate()?; Ok(config) } - pub(crate) fn from_file(config: &Path) -> Result { + pub(crate) fn from_file(config: &Path) -> Result { //read from file let content = fs::read_to_string(config)?; let content = BuildDescriptionSource::new(content, config); @@ -86,7 +84,7 @@ impl ProjectConfig { Ok(project) } - fn get_schema() -> Result { + fn get_schema() -> Result { let current_exe_dir = std::env::current_exe()?.parent().map(|it| it.to_path_buf()).unwrap_or_default(); let schema_dir = current_exe_dir.join("schema"); @@ -100,13 +98,17 @@ impl ProjectConfig { }; let path = schema_dir.join("plc-json.schema"); if !path.exists() { - Err(Diagnostic::io_read_error(&path.to_string_lossy(), "File not found")) + Err(std::io::Error::new( + std::io::ErrorKind::NotFound, + format!("{}: File not found", path.to_string_lossy()), + ) + .into()) } else { Ok(path) } } - fn validate(&self) -> Result<(), Diagnostic> { + fn validate(&self) -> Result<()> { let schema_path = match Self::get_schema() { Ok(path) => path, Err(error) => { @@ -132,13 +134,14 @@ impl ProjectConfig { } // XXX: jsonschema does not provide error messages with location info - Diagnostic::invalid_build_description_file(message, None) - }) + Diagnostic::error(message).with_error_code("E088") + })?; + Ok(()) } } //TODO: I don't think this belongs here -fn resolve_environment_variables(to_replace: &str) -> Result { +fn resolve_environment_variables(to_replace: &str) -> Result { let pattern = Regex::new(r"\$(\w+)")?; let result = pattern.replace_all(to_replace, |it: &Captures| { let original = it.get(0).map(|it| it.as_str().to_string()).unwrap(); diff --git a/compiler/plc_project/src/project.rs b/compiler/plc_project/src/project.rs index 81e2dec4f7..4a24c73a93 100644 --- a/compiler/plc_project/src/project.rs +++ b/compiler/plc_project/src/project.rs @@ -3,8 +3,8 @@ use std::{ path::{Path, PathBuf}, }; +use anyhow::{Context, Result}; use glob::glob; -use plc_diagnostics::diagnostics::Diagnostic; use crate::{ build_config::{LinkageInfo, ProjectConfig}, @@ -123,7 +123,7 @@ impl CompiledLibrary { //configuration impl Project { /// Retrieve a project for compilation from a json description - pub fn from_config(config: &Path) -> Result { + pub fn from_config(config: &Path) -> Result { let project_config = ProjectConfig::from_file(config)?; let libraries = project_config .libraries @@ -155,7 +155,7 @@ impl Project { library: Library::Compiled(compiled_library), }) }) - .collect::, Diagnostic>>()?; + .collect::>>()?; let current_dir = env::current_dir()?; let location = config.parent().map(Path::to_path_buf).or(Some(current_dir)); @@ -283,16 +283,15 @@ impl Project { } } -fn resolve_file_paths(location: Option<&Path>, inputs: Vec) -> Result, Diagnostic> { +fn resolve_file_paths(location: Option<&Path>, inputs: Vec) -> Result> { let mut sources = Vec::new(); for input in &inputs { let input = location.map(|it| it.join(input)).unwrap_or(input.to_path_buf()); let path = &input.to_string_lossy(); - let paths = glob(path) - .map_err(|e| Diagnostic::param_error(&format!("Failed to read glob pattern: {path}, ({e})")))?; + let paths = glob(path).context(format!("Failed to read glob pattern {path}"))?; for p in paths { - let path = p.map_err(|err| Diagnostic::param_error(&format!("Illegal path: {err}")))?; + let path = p.context("Illegal Path")?; sources.push(path); } } diff --git a/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_additional_fields_reports_unexpected_fields.snap b/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_additional_fields_reports_unexpected_fields.snap index 03c3ae9557..098a424528 100644 --- a/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_additional_fields_reports_unexpected_fields.snap +++ b/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_additional_fields_reports_unexpected_fields.snap @@ -2,4 +2,4 @@ source: compiler/plc_project/src/build_config.rs expression: diag.to_string() --- -plc_json__invalid: unknown field `additional_field`, expected one of `name`, `files`, `compile_type`, `output`, `libraries`, `package_commands`, `version`, `format-version`, `format_version` at: :9:27:{9:27-9:215}: +E088: unknown field `additional_field`, expected one of `name`, `files`, `compile_type`, `output`, `libraries`, `package_commands`, `version`, `format-version`, `format_version` at: :9:27:{9:27-9:215}: diff --git a/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_empty_files_array_reports_error.snap b/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_empty_files_array_reports_error.snap index 423f7c98eb..c265222eab 100644 --- a/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_empty_files_array_reports_error.snap +++ b/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_empty_files_array_reports_error.snap @@ -2,6 +2,6 @@ source: compiler/plc_project/src/build_config.rs expression: diag.to_string() --- -plc_json__invalid: plc.json could not be validated due to the following errors: +E088: plc.json could not be validated due to the following errors: files[] has less than 1 item diff --git a/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_invalid_enum_variants_reports_error.snap b/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_invalid_enum_variants_reports_error.snap index 6be1942573..b6c413b68a 100644 --- a/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_invalid_enum_variants_reports_error.snap +++ b/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_invalid_enum_variants_reports_error.snap @@ -2,4 +2,4 @@ source: compiler/plc_project/src/build_config.rs expression: diag.to_string() --- -plc_json__invalid: unknown variant `Interpreted`, expected one of `Object`, `Static`, `PIC`, `Shared`, `NoPIC`, `Relocatable`, `Bitcode`, `IR` at: :7:38:{7:38-7:168}: +E088: unknown variant `Interpreted`, expected one of `Object`, `Static`, `PIC`, `Shared`, `NoPIC`, `Relocatable`, `Bitcode`, `IR` at: :7:38:{7:38-7:168}: diff --git a/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_missing_required_properties_reports_error-2.snap b/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_missing_required_properties_reports_error-2.snap index 557cfea9bc..563b8c7250 100644 --- a/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_missing_required_properties_reports_error-2.snap +++ b/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_missing_required_properties_reports_error-2.snap @@ -2,4 +2,4 @@ source: compiler/plc_project/src/build_config.rs expression: diag.to_string() --- -plc_json__invalid: missing field `path` at: :16:13:{16:13-16:391}: +E088: missing field `path` at: :16:13:{16:13-16:391}: diff --git a/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_missing_required_properties_reports_error.snap b/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_missing_required_properties_reports_error.snap index 764f4e1fb2..a5a0878e5c 100644 --- a/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_missing_required_properties_reports_error.snap +++ b/compiler/plc_project/src/snapshots/plc_project__build_config__tests__json_with_missing_required_properties_reports_error.snap @@ -2,4 +2,4 @@ source: compiler/plc_project/src/build_config.rs expression: diag.to_string() --- -plc_json__invalid: missing field `name` at: :6:9:{6:9-6:100}: +E088: missing field `name` at: :6:9:{6:9-6:100}: diff --git a/compiler/plc_xml/src/model/fbd.rs b/compiler/plc_xml/src/model/fbd.rs index 5951948407..a20da39969 100644 --- a/compiler/plc_xml/src/model/fbd.rs +++ b/compiler/plc_xml/src/model/fbd.rs @@ -235,18 +235,16 @@ impl<'xml> ConnectionResolver<'xml> for NodeIndex<'xml> { kind: ConnectorKind::Source, name, ref_local_id, .. })) => { current = ref_local_id.ok_or_else(|| { - Diagnostic::unconnected_source( - name.as_ref(), - source_location_factory.create_block_location(current, None), - ) + Diagnostic::error(format!("Source '{name}' is not connected.")) + .with_error_code("E084") + .with_location(source_location_factory.create_block_location(current, None)) })? } Some(Node::Connector(Connector { kind: ConnectorKind::Sink, name, .. })) => { current = *source_connections.get(name.as_ref()).ok_or_else(|| { - Diagnostic::sink_without_associated_source( - name.as_ref(), - source_location_factory.create_block_location(current, None), - ) + Diagnostic::error(format!("Expected a corresponding source-connection mark for sink '{name}', but could not find one.")) + .with_error_code("E086") + .with_location(source_location_factory.create_block_location(current, None)) })? } _ => return Ok(current), @@ -262,8 +260,11 @@ impl<'xml> ConnectionResolver<'xml> for NodeIndex<'xml> { let node = self.get(¤t).expect("Node exists"); msg.push_str(node.get_name()); - return Err(Diagnostic::cyclic_connection( - msg.to_string(), + return Err(Diagnostic::error(format!( + "Sink is connected to itself. Found the following recursion: {msg}" + )) + .with_error_code("E085") + .with_location( source_location_factory.create_block_location(node.get_id(), node.get_exec_id()), )); } diff --git a/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__recursive_sink_source_connections_are_an_error.snap b/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__recursive_sink_source_connections_are_an_error.snap index 8e4cefd2b1..b6dd396011 100644 --- a/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__recursive_sink_source_connections_are_an_error.snap +++ b/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__recursive_sink_source_connections_are_an_error.snap @@ -3,43 +3,49 @@ source: compiler/plc_xml/src/model/fbd.rs expression: err --- [ - SemanticError { + Diagnostic { message: "Sink is connected to itself. Found the following recursion: connection2 -> connection1 -> connection2", - range: [ - SourceLocation { - span: Block { - local_id: 6, - execution_order: None, - inner_range: None, - }, + primary_location: SourceLocation { + span: Block { + local_id: 6, + execution_order: None, + inner_range: None, }, - ], - err_no: cfc__cyclic_connection, + }, + secondary_locations: None, + severity: Error, + error_code: "E085", + sub_diagnostics: [], + internal_error: None, }, - SemanticError { + Diagnostic { message: "Sink is connected to itself. Found the following recursion: connection2 -> connection1 -> connection2", - range: [ - SourceLocation { - span: Block { - local_id: 6, - execution_order: None, - inner_range: None, - }, + primary_location: SourceLocation { + span: Block { + local_id: 6, + execution_order: None, + inner_range: None, }, - ], - err_no: cfc__cyclic_connection, + }, + secondary_locations: None, + severity: Error, + error_code: "E085", + sub_diagnostics: [], + internal_error: None, }, - SemanticError { + Diagnostic { message: "Sink is connected to itself. Found the following recursion: connection1 -> connection2 -> connection1", - range: [ - SourceLocation { - span: Block { - local_id: 5, - execution_order: None, - inner_range: None, - }, + primary_location: SourceLocation { + span: Block { + local_id: 5, + execution_order: None, + inner_range: None, }, - ], - err_no: cfc__cyclic_connection, + }, + secondary_locations: None, + severity: Error, + error_code: "E085", + sub_diagnostics: [], + internal_error: None, }, ] diff --git a/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__unassociated_sink_removed_from_model_with_error.snap b/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__unassociated_sink_removed_from_model_with_error.snap index e47adbaeb4..7fd73c3750 100644 --- a/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__unassociated_sink_removed_from_model_with_error.snap +++ b/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__unassociated_sink_removed_from_model_with_error.snap @@ -3,17 +3,19 @@ source: compiler/plc_xml/src/model/fbd.rs expression: err --- [ - SemanticError { + Diagnostic { message: "Expected a corresponding source-connection mark for sink 'connection1', but could not find one.", - range: [ - SourceLocation { - span: Block { - local_id: 3, - execution_order: None, - inner_range: None, - }, + primary_location: SourceLocation { + span: Block { + local_id: 3, + execution_order: None, + inner_range: None, }, - ], - err_no: cfc__no_associated_connector, + }, + secondary_locations: None, + severity: Error, + error_code: "E086", + sub_diagnostics: [], + internal_error: None, }, ] diff --git a/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__unconnected_source_has_no_effect.snap b/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__unconnected_source_has_no_effect.snap index d8ce666ffc..9834770bb3 100644 --- a/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__unconnected_source_has_no_effect.snap +++ b/compiler/plc_xml/src/model/snapshots/plc_xml__model__fbd__tests__unconnected_source_has_no_effect.snap @@ -3,17 +3,19 @@ source: compiler/plc_xml/src/model/fbd.rs expression: err --- [ - SemanticError { + Diagnostic { message: "Source 'connection1' is not connected.", - range: [ - SourceLocation { - span: Block { - local_id: 3, - execution_order: None, - inner_range: None, - }, + primary_location: SourceLocation { + span: Block { + local_id: 3, + execution_order: None, + inner_range: None, }, - ], - err_no: cfc__unconnected_source, + }, + secondary_locations: None, + severity: Error, + error_code: "E084", + sub_diagnostics: [], + internal_error: None, }, ] diff --git a/compiler/plc_xml/src/xml_parser/control.rs b/compiler/plc_xml/src/xml_parser/control.rs index dc296331f7..ad3a4eef71 100644 --- a/compiler/plc_xml/src/xml_parser/control.rs +++ b/compiler/plc_xml/src/xml_parser/control.rs @@ -26,12 +26,14 @@ fn get_connection( let Some(ref_local_id) = control.ref_local_id else { let location = session.range_factory.create_block_location(control.local_id, control.execution_order_id); - return Err(Diagnostic::empty_control_statement(location)); + return Err(Diagnostic::error("Control statement has no connection").with_error_code("E081").with_location(location)); }; let Some(node) = index.get(&ref_local_id) else { let location = session.range_factory.create_block_location(ref_local_id, None); - return Err(Diagnostic::undefined_node(control.local_id, ref_local_id, location)); + return Err(Diagnostic::error(format!("Node {} is referencing a non-existing element with ID {ref_local_id}",control.local_id)) + .with_error_code("E082") + .with_location(location)); }; match node { @@ -44,7 +46,9 @@ fn get_connection( let location_other = session.range_factory.create_block_location(ref_local_id, node.get_exec_id()); - Err(Diagnostic::unexpected_nodes(location_control.span(&location_other))) + Err(Diagnostic::error("Unexpected relationship between nodes") + .with_error_code("E083") + .with_location(location_control.span(&location_other))) } } } diff --git a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__control__tests__unconnected_jump_generated_as_empty_statement-2.snap b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__control__tests__unconnected_jump_generated_as_empty_statement-2.snap index 74eac2ef68..ed6146e596 100644 --- a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__control__tests__unconnected_jump_generated_as_empty_statement-2.snap +++ b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__control__tests__unconnected_jump_generated_as_empty_statement-2.snap @@ -3,19 +3,21 @@ source: compiler/plc_xml/src/xml_parser/control.rs expression: diagnostics --- [ - SemanticError { + Diagnostic { message: "Control statement has no connection", - range: [ - SourceLocation { - span: Block { - local_id: 2, - execution_order: Some( - 1, - ), - inner_range: None, - }, + primary_location: SourceLocation { + span: Block { + local_id: 2, + execution_order: Some( + 1, + ), + inner_range: None, }, - ], - err_no: cfc__empty_control_statement, + }, + secondary_locations: None, + severity: Error, + error_code: "E081", + sub_diagnostics: [], + internal_error: None, }, ] diff --git a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__control__tests__unnamed_controls-2.snap b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__control__tests__unnamed_controls-2.snap index 8e23c01286..3dfb0622c2 100644 --- a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__control__tests__unnamed_controls-2.snap +++ b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__control__tests__unnamed_controls-2.snap @@ -3,34 +3,38 @@ source: compiler/plc_xml/src/xml_parser/control.rs expression: diagnostics --- [ - SemanticError { + Diagnostic { message: "Unnamed control", - range: [ - SourceLocation { - span: Block { - local_id: 1, - execution_order: Some( - 0, - ), - inner_range: None, - }, + primary_location: SourceLocation { + span: Block { + local_id: 1, + execution_order: Some( + 0, + ), + inner_range: None, }, - ], - err_no: cfc__unnamed_control, + }, + secondary_locations: None, + severity: Error, + error_code: "E087", + sub_diagnostics: [], + internal_error: None, }, - SemanticError { + Diagnostic { message: "Unnamed control", - range: [ - SourceLocation { - span: Block { - local_id: 2, - execution_order: Some( - 1, - ), - inner_range: None, - }, + primary_location: SourceLocation { + span: Block { + local_id: 2, + execution_order: Some( + 1, + ), + inner_range: None, }, - ], - err_no: cfc__unnamed_control, + }, + secondary_locations: None, + severity: Error, + error_code: "E087", + sub_diagnostics: [], + internal_error: None, }, ] diff --git a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__conditional_return_chained_to_another_conditional_return.snap b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__conditional_return_chained_to_another_conditional_return.snap index 0eeecc467c..080db302ba 100644 --- a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__conditional_return_chained_to_another_conditional_return.snap +++ b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__conditional_return_chained_to_another_conditional_return.snap @@ -3,51 +3,55 @@ source: compiler/plc_xml/src/xml_parser/tests.rs expression: diagnostics --- [ - SemanticError { + Diagnostic { message: "Control statement has no connection", - range: [ - SourceLocation { - span: Block { - local_id: 1, - execution_order: Some( - 0, - ), - inner_range: None, - }, - file: Some( - "test.cfc", + primary_location: SourceLocation { + span: Block { + local_id: 1, + execution_order: Some( + 0, ), + inner_range: None, }, - ], - err_no: cfc__empty_control_statement, + file: Some( + "test.cfc", + ), + }, + secondary_locations: None, + severity: Error, + error_code: "E081", + sub_diagnostics: [], + internal_error: None, }, - SemanticError { + Diagnostic { message: "Unexpected relationship between nodes", - range: [ - SourceLocation { - span: Combined( - [ - Block { - local_id: 2, - execution_order: Some( - 1, - ), - inner_range: None, - }, - Block { - local_id: 1, - execution_order: Some( - 0, - ), - inner_range: None, - }, - ], - ), - file: Some( - "test.cfc", - ), - }, - ], - err_no: cfc__unexpected_node, + primary_location: SourceLocation { + span: Combined( + [ + Block { + local_id: 2, + execution_order: Some( + 1, + ), + inner_range: None, + }, + Block { + local_id: 1, + execution_order: Some( + 0, + ), + inner_range: None, + }, + ], + ), + file: Some( + "test.cfc", + ), + }, + secondary_locations: None, + severity: Error, + error_code: "E083", + sub_diagnostics: [], + internal_error: None, }, ] diff --git a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__conditional_return_without_connection.snap b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__conditional_return_without_connection.snap index 29693f63d8..b9d13f018a 100644 --- a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__conditional_return_without_connection.snap +++ b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__conditional_return_without_connection.snap @@ -3,22 +3,24 @@ source: compiler/plc_xml/src/xml_parser/tests.rs expression: diagnostics --- [ - SemanticError { + Diagnostic { message: "Control statement has no connection", - range: [ - SourceLocation { - span: Block { - local_id: 2, - execution_order: Some( - 0, - ), - inner_range: None, - }, - file: Some( - "test.cfc", + primary_location: SourceLocation { + span: Block { + local_id: 2, + execution_order: Some( + 0, ), + inner_range: None, }, - ], - err_no: cfc__empty_control_statement, + file: Some( + "test.cfc", + ), + }, + secondary_locations: None, + severity: Error, + error_code: "E081", + sub_diagnostics: [], + internal_error: None, }, ] diff --git a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__sink_source_data_recursion_does_not_overflow_the_stack.snap b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__sink_source_data_recursion_does_not_overflow_the_stack.snap index db83ea3145..85f0e0e34e 100644 --- a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__sink_source_data_recursion_does_not_overflow_the_stack.snap +++ b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__sink_source_data_recursion_does_not_overflow_the_stack.snap @@ -3,52 +3,58 @@ source: compiler/plc_xml/src/xml_parser/tests.rs expression: diagnostics --- [ - SemanticError { + Diagnostic { message: "Sink is connected to itself. Found the following recursion: s3 -> s2 -> s1 -> s3", - range: [ - SourceLocation { - span: Block { - local_id: 23, - execution_order: None, - inner_range: None, - }, - file: Some( - "test", - ), + primary_location: SourceLocation { + span: Block { + local_id: 23, + execution_order: None, + inner_range: None, }, - ], - err_no: cfc__cyclic_connection, + file: Some( + "test", + ), + }, + secondary_locations: None, + severity: Error, + error_code: "E085", + sub_diagnostics: [], + internal_error: None, }, - SemanticError { + Diagnostic { message: "Sink is connected to itself. Found the following recursion: s1 -> s3 -> s2 -> s1", - range: [ - SourceLocation { - span: Block { - local_id: 24, - execution_order: None, - inner_range: None, - }, - file: Some( - "test", - ), + primary_location: SourceLocation { + span: Block { + local_id: 24, + execution_order: None, + inner_range: None, }, - ], - err_no: cfc__cyclic_connection, + file: Some( + "test", + ), + }, + secondary_locations: None, + severity: Error, + error_code: "E085", + sub_diagnostics: [], + internal_error: None, }, - SemanticError { + Diagnostic { message: "Sink is connected to itself. Found the following recursion: s2 -> s1 -> s3 -> s2", - range: [ - SourceLocation { - span: Block { - local_id: 26, - execution_order: None, - inner_range: None, - }, - file: Some( - "test", - ), + primary_location: SourceLocation { + span: Block { + local_id: 26, + execution_order: None, + inner_range: None, }, - ], - err_no: cfc__cyclic_connection, + file: Some( + "test", + ), + }, + secondary_locations: None, + severity: Error, + error_code: "E085", + sub_diagnostics: [], + internal_error: None, }, ] diff --git a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__unassociated_connections.snap b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__unassociated_connections.snap index 48da7815dc..73b8776ee9 100644 --- a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__unassociated_connections.snap +++ b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__unassociated_connections.snap @@ -3,20 +3,22 @@ source: compiler/plc_xml/src/xml_parser/tests.rs expression: diagnostics --- [ - SemanticError { + Diagnostic { message: "Expected a corresponding source-connection mark for sink 's2', but could not find one.", - range: [ - SourceLocation { - span: Block { - local_id: 3, - execution_order: None, - inner_range: None, - }, - file: Some( - "test", - ), + primary_location: SourceLocation { + span: Block { + local_id: 3, + execution_order: None, + inner_range: None, }, - ], - err_no: cfc__no_associated_connector, + file: Some( + "test", + ), + }, + secondary_locations: None, + severity: Error, + error_code: "E086", + sub_diagnostics: [], + internal_error: None, }, ] diff --git a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__unconnected_connections.snap b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__unconnected_connections.snap index 81f6356850..e3fa8eeb65 100644 --- a/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__unconnected_connections.snap +++ b/compiler/plc_xml/src/xml_parser/snapshots/plc_xml__xml_parser__tests__unconnected_connections.snap @@ -3,20 +3,22 @@ source: compiler/plc_xml/src/xml_parser/tests.rs expression: diagnostics --- [ - SemanticError { + Diagnostic { message: "Source 's1' is not connected.", - range: [ - SourceLocation { - span: Block { - local_id: 1, - execution_order: None, - inner_range: None, - }, - file: Some( - "test", - ), + primary_location: SourceLocation { + span: Block { + local_id: 1, + execution_order: None, + inner_range: None, }, - ], - err_no: cfc__unconnected_source, + file: Some( + "test", + ), + }, + secondary_locations: None, + severity: Error, + error_code: "E084", + sub_diagnostics: [], + internal_error: None, }, ] diff --git a/libs/stdlib/iec61131-st/string_conversion.st b/libs/stdlib/iec61131-st/string_conversion.st index 1903738316..bede652f70 100644 --- a/libs/stdlib/iec61131-st/string_conversion.st +++ b/libs/stdlib/iec61131-st/string_conversion.st @@ -25,15 +25,11 @@ END_FUNCTION * Converts WSTRING to WCHAR * *********************) +{external} FUNCTION WSTRING_TO_WCHAR : WCHAR VAR_INPUT {ref} in : WSTRING; END_VAR -VAR - ptr : REF_TO WCHAR; -END_VAR - ptr := ∈ - WSTRING_TO_WCHAR := ptr^; END_FUNCTION (******************** @@ -64,15 +60,11 @@ END_FUNCTION * Converts STRING to CHAR * *********************) +{external} FUNCTION STRING_TO_CHAR : CHAR VAR_INPUT {ref} in : STRING; END_VAR -VAR - ptr : REF_TO CHAR; -END_VAR - ptr := ∈ - STRING_TO_CHAR := ptr^; END_FUNCTION (******************** @@ -80,15 +72,11 @@ END_FUNCTION * Converts WCHAR to WSTRING * *********************) +{external} FUNCTION WCHAR_TO_WSTRING : WSTRING VAR_INPUT in : WCHAR; END_VAR -VAR - ptr : REF_TO WSTRING; -END_VAR - ptr := ∈ - WCHAR_TO_WSTRING := ptr^; END_FUNCTION (******************** @@ -108,15 +96,11 @@ END_FUNCTION * Converts CHAR to STRING * *********************) +{external} FUNCTION CHAR_TO_STRING : STRING VAR_INPUT in : CHAR; END_VAR -VAR - ptr : REF_TO STRING; -END_VAR - ptr := ∈ - CHAR_TO_STRING := ptr^; END_FUNCTION (******************** diff --git a/libs/stdlib/src/string_conversion.rs b/libs/stdlib/src/string_conversion.rs index 61ff7806dc..cc3999696e 100644 --- a/libs/stdlib/src/string_conversion.rs +++ b/libs/stdlib/src/string_conversion.rs @@ -69,3 +69,49 @@ pub extern "C" fn CHAR_TO_WCHAR(input: u8) -> u16 { res.encode_utf16(&mut arr); arr[0] } + +///. +/// Converts STRING to CHAR +/// # Safety +/// uses raw pointer +/// +#[allow(non_snake_case)] +#[no_mangle] +pub unsafe extern "C" fn STRING_TO_CHAR(input: *const u8) -> u8 { + *input +} + +///. +/// Converts WSTRING to WCHAR +/// # Safety +/// uses raw pointer +/// +#[allow(non_snake_case)] +#[no_mangle] +pub unsafe extern "C" fn WSTRING_TO_WCHAR(input: *const u16) -> u16 { + *input +} + +///. +/// Converts CHAR to STRING +/// # Safety +/// uses raw pointer +/// +#[allow(non_snake_case)] +#[no_mangle] +pub unsafe extern "C" fn CHAR_TO_STRING(dest: *mut u8, input: u8) -> i32 { + *dest = input; + 0 +} + +///. +/// Converts WCHAR to WSTRING +/// # Safety +/// uses raw pointer +/// +#[allow(non_snake_case)] +#[no_mangle] +pub unsafe extern "C" fn WCHAR_TO_WSTRING(dest: *mut u16, input: u16) -> i32 { + *dest = input; + 0 +} diff --git a/libs/stdlib/tests/common/mod.rs b/libs/stdlib/tests/common/mod.rs index 93eba4e5ba..8d4895fdfc 100644 --- a/libs/stdlib/tests/common/mod.rs +++ b/libs/stdlib/tests/common/mod.rs @@ -84,6 +84,10 @@ pub fn compile_with_native(context: &CodegenContext, source: T) - ("REAL_TO_DWORD", iec61131std::bit_num_conversion::REAL_TO_DWORD as usize), ("WSTRING_TO_STRING_EXT", iec61131std::string_conversion::WSTRING_TO_STRING_EXT as usize), ("STRING_TO_WSTRING_EXT", iec61131std::string_conversion::STRING_TO_WSTRING_EXT as usize), + ("STRING_TO_CHAR", iec61131std::string_conversion::STRING_TO_CHAR as usize), + ("WSTRING_TO_WCHAR", iec61131std::string_conversion::WSTRING_TO_WCHAR as usize), + ("CHAR_TO_STRING", iec61131std::string_conversion::CHAR_TO_STRING as usize), + ("WCHAR_TO_WSTRING", iec61131std::string_conversion::WCHAR_TO_WSTRING as usize), ("WCHAR_TO_CHAR", iec61131std::string_conversion::WCHAR_TO_CHAR as usize), ("CHAR_TO_WCHAR", iec61131std::string_conversion::CHAR_TO_WCHAR as usize), ("SHL__BYTE", iec61131std::bit_shift_functions::SHL__BYTE as usize), diff --git a/src/builtins.rs b/src/builtins.rs index 5ea50f91dc..9ea1f232be 100644 --- a/src/builtins.rs +++ b/src/builtins.rs @@ -263,7 +263,7 @@ lazy_static! { // return size of llvm type let size = generator.llvm_index .get_associated_type(type_name) - .map_err(|_| Diagnostic::codegen_error(&format!("Could not find associated data type: {type_name}"), location.clone()) + .map_err(|_| Diagnostic::codegen_error(format!("Could not find associated data type: {type_name}"), location.clone()) )?.size_of() .ok_or_else(|| Diagnostic::codegen_error("Parameter type is not sized.", location.clone()))? .as_basic_value_enum(); @@ -767,11 +767,15 @@ fn validate_variable_length_array_bound_function( let idx_type = annotations.get_type_or_void(idx, index); if !idx_type.has_nature(TypeNature::Int, index) { - validator.push_diagnostic(Diagnostic::invalid_type_nature( - idx_type.get_name(), - &format!("{:?}", TypeNature::Int), - idx.get_location(), - )) + validator.push_diagnostic( + Diagnostic::error(format!( + "Invalid type nature for generic argument. {} is no {}", + idx_type.get_name(), + TypeNature::Int + )) + .with_error_code("E062") + .with_location(idx.get_location()), + ) } // TODO: consider adding validation for consts and enums once https://github.com/PLC-lang/rusty/issues/847 has been implemented @@ -786,7 +790,11 @@ fn validate_variable_length_array_bound_function( }; if dimension_idx < 1 || dimension_idx > n_dimensions { - validator.push_diagnostic(Diagnostic::index_out_of_bounds(operator.get_location())) + validator.push_diagnostic( + Diagnostic::error("Index out of bound") + .with_error_code("E046") + .with_location(operator.get_location()), + ) } }; } @@ -814,7 +822,7 @@ fn generate_variable_length_array_bound_function<'ink>( // once we abort codegen on critical errors, revisit and change to unreachable where possible if !data_type_information.is_vla() { return Err(Diagnostic::codegen_error( - &format!("Expected VLA type, received {}", data_type_information.get_name()), + format!("Expected VLA type, received {}", data_type_information.get_name()), location, )); }; @@ -830,7 +838,7 @@ fn generate_variable_length_array_bound_function<'ink>( unreachable!("type cannot be VOID") }; return Err(Diagnostic::codegen_error( - &format!("Invalid literal type. Expected INT type, received {type_name} type"), + format!("Invalid literal type. Expected INT type, received {type_name} type"), location, )); }; @@ -846,7 +854,7 @@ fn generate_variable_length_array_bound_function<'ink>( if !value.is_int_value() { return Err(Diagnostic::codegen_error( - &format!("Expected INT value, found {}", value.get_type()), + format!("Expected INT value, found {}", value.get_type()), location, )); }; diff --git a/src/codegen.rs b/src/codegen.rs index fb9f5ce00e..12918eeda8 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -216,10 +216,7 @@ impl<'ink> CodeGen<'ink> { { self.module .verify() - .map_err(|it| Diagnostic::GeneralError { - message: it.to_string(), - err_no: crate::diagnostics::ErrNo::codegen__general, - }) + .map_err(|it| Diagnostic::GeneralError { message: it.to_string(), err_no: "E071" }) .map(|_| GeneratedModule { module: self.module, debug: self.debug }) } @@ -230,13 +227,17 @@ impl<'ink> CodeGen<'ink> { impl<'ink> GeneratedModule<'ink> { pub fn try_from_bitcode(context: &'ink CodegenContext, path: &Path) -> Result { - let module = Module::parse_bitcode_from_path(path, context.deref())?; + let module = Module::parse_bitcode_from_path(path, context.deref()) + .map_err(|it| Diagnostic::error(it.to_string_lossy()).with_error_code("E071"))?; Ok(GeneratedModule { module, engine: RefCell::new(None) }) } pub fn try_from_ir(context: &'ink CodegenContext, path: &Path) -> Result { - let buffer = MemoryBuffer::create_from_file(path)?; - let module = context.create_module_from_ir(buffer)?; + let buffer = MemoryBuffer::create_from_file(path) + .map_err(|it| Diagnostic::error(it.to_string_lossy()).with_error_code("E071"))?; + let module = context + .create_module_from_ir(buffer) + .map_err(|it| Diagnostic::error(it.to_string_lossy()).with_error_code("E071"))?; log::debug!("{}", module.to_string()); @@ -244,7 +245,9 @@ impl<'ink> GeneratedModule<'ink> { } pub fn merge(self, other: GeneratedModule<'ink>) -> Result { - self.module.link_in_module(other.module)?; + self.module + .link_in_module(other.module) + .map_err(|it| Diagnostic::error(it.to_string_lossy()).with_error_code("E071"))?; log::debug!("Merged: {}", self.module.to_string()); Ok(self) @@ -305,7 +308,7 @@ impl<'ink> GeneratedModule<'ink> { let target = inkwell::targets::Target::from_triple(&triple).map_err(|it| { Diagnostic::codegen_error( - &format!("Invalid target-tripple '{triple}' - {it:?}"), + format!("Invalid target-tripple '{triple}' - {it:?}"), SourceLocation::undefined(), ) })?; @@ -333,11 +336,11 @@ impl<'ink> GeneratedModule<'ink> { self.module .run_passes(optimization_level.opt_params(), &it, PassBuilderOptions::create()) .map_err(|it| { - Diagnostic::llvm_error(output.to_str().unwrap_or_default(), &it.to_string()) + Diagnostic::llvm_error(output.to_str().unwrap_or_default(), &it.to_string_lossy()) }) .and_then(|_| { it.write_to_file(&self.module, FileType::Object, output.as_path()).map_err(|it| { - Diagnostic::llvm_error(output.to_str().unwrap_or_default(), &it.to_string()) + Diagnostic::llvm_error(output.to_str().unwrap_or_default(), &it.to_string_lossy()) }) }) }) @@ -423,7 +426,12 @@ impl<'ink> GeneratedModule<'ink> { self.module .print_to_file(&output) .map_err(|err| { - Diagnostic::io_write_error(output.to_str().unwrap_or_default(), err.to_string().as_str()) + Diagnostic::error(format!( + "Cannot write file {} {}", + output.to_str().unwrap_or_default(), + err.to_string() + )) + .with_error_code("E002") }) .map(|_| output) } diff --git a/src/codegen/debug.rs b/src/codegen/debug.rs index 2eb056ba93..3618e8325d 100644 --- a/src/codegen/debug.rs +++ b/src/codegen/debug.rs @@ -334,7 +334,7 @@ impl<'ink> DebugBuilder<'ink> { .map(|it| it.get_range(index)) //Convert to normal range .collect::>, _>>() - .map_err(|err| Diagnostic::codegen_error(&err, SourceLocation::undefined()))?; + .map_err(|err| Diagnostic::codegen_error(err, SourceLocation::undefined()))?; let inner_type = self.get_or_create_debug_type(inner_type, index)?; let array_type = self.debug_info.create_array_type( inner_type.into(), @@ -380,7 +380,8 @@ impl<'ink> DebugBuilder<'ink> { self.types .get(&dt_name) .ok_or_else(|| { - Diagnostic::debug_error(format!("Cannot find debug information for type {dt_name}")) + Diagnostic::error(format!("Cannot find debug information for type {dt_name}")) + .with_error_code("E076") }) .map(|it| it.to_owned()) } @@ -658,7 +659,7 @@ impl<'ink> Debug<'ink> for DebugBuilder<'ink> { DataTypeInformation::String { size: string_size, encoding, .. } => { let length = string_size .as_int_value(index) - .map_err(|err| Diagnostic::codegen_error(&err, SourceLocation::undefined()))?; + .map_err(|err| Diagnostic::codegen_error(err, SourceLocation::undefined()))?; self.create_string_type(name, length, *encoding, size, alignment, index) } DataTypeInformation::Alias { name, referenced_type } diff --git a/src/codegen/generators/data_type_generator.rs b/src/codegen/generators/data_type_generator.rs index 09a3786565..d6c5ecf579 100644 --- a/src/codegen/generators/data_type_generator.rs +++ b/src/codegen/generators/data_type_generator.rs @@ -20,7 +20,6 @@ use inkwell::{ use plc_ast::ast::{AstNode, AstStatement}; use plc_ast::literals::AstLiteral; use plc_diagnostics::diagnostics::Diagnostic; -use plc_diagnostics::errno::ErrNo; use plc_source::source_location::SourceLocation; /// the data_type_generator generates user defined data-types /// - Structures @@ -155,16 +154,14 @@ pub fn generate_data_types<'ink>( .map(|(name, ty)| { errors .remove(name) - .map(|diag| diag.with_extra_ranges(&[ty.location.clone()])) + .map(|diag| diag.with_secondary_location(ty.location.clone())) .unwrap_or_else(|| Diagnostic::cannot_generate_initializer(name, ty.location.clone())) }) .collect::>(); //Report the operation failure - return Err(Diagnostic::CombinedDiagnostic { - message: "Some initial values were not generated".to_string(), - err_no: ErrNo::codegen__general, - inner_diagnostics: diags, - }); + return Err(Diagnostic::error("Some initial values were not generated") + .with_error_code("E075") + .with_sub_diagnostics(diags)); } Ok(generator.types_index) } @@ -230,11 +227,11 @@ impl<'ink, 'b> DataTypeGenerator<'ink, 'b> { if let DataTypeInformation::Integer { .. } = effective_type.get_type_information() { self.create_type(name, effective_type) } else { - Err(Diagnostic::invalid_type_nature( - effective_type.get_name(), - "ANY_INT", - SourceLocation::undefined(), + Err(Diagnostic::error(format!( + "Invalid type nature for generic argument. {} is no `ANY_INT`.", + effective_type.get_name() )) + .with_error_code("E062")) } } DataTypeInformation::Float { size, .. } => { @@ -405,7 +402,7 @@ impl<'ink, 'b> DataTypeGenerator<'ink, 'b> { Ok(Some(generator.generate_literal(initializer)?.get_basic_value_enum())) } else { Err(Diagnostic::codegen_error( - &format!("Expected {expected_ast} but found {initializer:?}"), + format!("Expected {expected_ast} but found {initializer:?}"), initializer.get_location(), )) } diff --git a/src/codegen/generators/expression_generator.rs b/src/codegen/generators/expression_generator.rs index 3b7f34588a..6693b9705c 100644 --- a/src/codegen/generators/expression_generator.rs +++ b/src/codegen/generators/expression_generator.rs @@ -344,7 +344,9 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { Ok(reference) } } else { - Err(Diagnostic::casting_error(access_type.get_name(), "Integer Type", index.get_location())) + Err(Diagnostic::error(format!("Cannot cast from {} to Integer Type", access_type.get_name())) + .with_error_code("E051") + .with_location(index.get_location())) } } @@ -445,7 +447,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { .find_associated_implementation(implementation_name) // using the non error option to control the output error .ok_or_else(|| { Diagnostic::codegen_error( - &format!("No callable implementation associated to {implementation_name:?}"), + format!("No callable implementation associated to {implementation_name:?}"), operator.get_location(), ) })?; @@ -556,7 +558,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { let output = builder.build_struct_gep(parameter_struct, index, "").map_err(|_| { Diagnostic::codegen_error( - &format!("Cannot build generate parameter: {parameter:#?}"), + format!("Cannot build generate parameter: {parameter:#?}"), parameter.source_location.clone(), ) })?; @@ -1015,7 +1017,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { .find_associated_pou_type(function_name) //Using find instead of get to control the compile error .ok_or_else(|| { Diagnostic::codegen_error( - &format!("No type associated with '{instance_name:}'"), + format!("No type associated with '{instance_name:}'"), context.get_location(), ) })?; @@ -1154,7 +1156,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { let pointer_to_param = builder.build_struct_gep(parameter_struct, index, "").map_err(|_| { Diagnostic::codegen_error( - &format!("Cannot build generate parameter: {expression:#?}"), + format!("Cannot build generate parameter: {expression:#?}"), expression.get_location(), ) })?; @@ -1355,7 +1357,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { let start_offset = dimension .start_offset .as_int_value(self.index) - .map_err(|it| Diagnostic::codegen_error(&it, access_expression.get_location()))?; + .map_err(|it| Diagnostic::codegen_error(it, access_expression.get_location()))?; let access_value = self.generate_expression(access_expression)?; //If start offset is not 0, adjust the current statement with an add operation @@ -1769,7 +1771,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { pub fn generate_literal(&self, literal_statement: &AstNode) -> Result, Diagnostic> { let cannot_generate_literal = || { Diagnostic::codegen_error( - &format!("Cannot generate Literal for {literal_statement:?}"), + format!("Cannot generate Literal for {literal_statement:?}"), literal_statement.get_location(), ) }; @@ -1901,7 +1903,12 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { DataTypeInformation::Integer { size: 16, .. } if expected_type.is_character() => { self.llvm.create_llvm_const_i16_char(value, location).map(ExpressionValue::RValue) } - _ => Err(Diagnostic::cannot_generate_string_literal(expected_type.get_name(), location.clone())), + _ => Err(Diagnostic::error(format!( + "Cannot generate String-Literal for type {}", + expected_type.get_name() + )) + .with_error_code("E074") + .with_location(location.clone())), } } @@ -1923,7 +1930,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { .or_else(|| self.annotations.get_type(statement, self.index)) .ok_or_else(|| { Diagnostic::codegen_error( - &format!("no type hint available for {statement:#?}"), + format!("no type hint available for {statement:#?}"), statement.get_location(), ) }) @@ -1992,7 +1999,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { )); } else { Err(Diagnostic::codegen_error( - &format!( + format!( "Expected {} fields for Struct {}, but found {}.", struct_type.count_fields(), struct_name, @@ -2003,7 +2010,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { } } else { Err(Diagnostic::codegen_error( - &format!("Expected Struct-literal, got {assignments:#?}"), + format!("Expected Struct-literal, got {assignments:#?}"), assignments.get_location(), )) } @@ -2181,7 +2188,7 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { Operator::And => builder.build_conditional_branch(lhs, right_branch, continue_branch), _ => { return Err(Diagnostic::codegen_error( - &format!("Cannot generate phi-expression for operator {operator:}"), + format!("Cannot generate phi-expression for operator {operator:}"), left.get_location(), )) } @@ -2570,11 +2577,16 @@ pub fn get_implicit_call_parameter<'a>( AstStatement::Assignment(data) | AstStatement::OutputAssignment(data) => { //explicit let Some(left_name) = data.left.as_ref().get_flat_reference_name() else { - return Err(Diagnostic::reference_expected(param_statement.get_location())); + return Err( + //TODO: use global context to get an expression slice + Diagnostic::error("Expression is not assignable") + .with_error_code("E050") + .with_location(param_statement.get_location()) + ); }; let loc = declared_parameters .iter() - .position(|p| p.get_name() == left_name) + .position(|p| p.get_name().eq_ignore_ascii_case(left_name)) .ok_or_else(|| Diagnostic::unresolved_reference(left_name, data.left.get_location()))?; (loc, data.right.as_ref(), false) } diff --git a/src/codegen/generators/llvm.rs b/src/codegen/generators/llvm.rs index 6023dc3b15..4dca0a578f 100644 --- a/src/codegen/generators/llvm.rs +++ b/src/codegen/generators/llvm.rs @@ -133,7 +133,7 @@ impl<'a> Llvm<'a> { ) -> Result, Diagnostic> { self.builder.build_struct_gep(pointer_to_struct_instance, member_index, name).map_err(|_| { Diagnostic::codegen_error( - &format!("Cannot generate qualified reference for {name:}"), + format!("Cannot generate qualified reference for {name:}"), offset.clone(), ) }) @@ -184,7 +184,7 @@ impl<'a> Llvm<'a> { match target_type { BasicTypeEnum::IntType { 0: int_type } => int_type .const_int_from_string(value, StringRadix::Decimal) - .ok_or_else(|| Diagnostic::codegen_error(&format!("Cannot parse {value} as int"), location)) + .ok_or_else(|| Diagnostic::codegen_error(format!("Cannot parse {value} as int"), location)) .map(BasicValueEnum::IntValue), BasicTypeEnum::FloatType { 0: float_type } => { let value = float_type.const_float_from_string(value); diff --git a/src/codegen/generators/pou_generator.rs b/src/codegen/generators/pou_generator.rs index fd12513cc1..f45f1acd24 100644 --- a/src/codegen/generators/pou_generator.rs +++ b/src/codegen/generators/pou_generator.rs @@ -289,7 +289,7 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { let current_function = self.llvm_index.find_associated_implementation(pou_name).ok_or_else(|| { Diagnostic::codegen_error( - &format!("Could not find generated stub for {pou_name}"), + format!("Could not find generated stub for {pou_name}"), implementation.location.clone(), ) })?; @@ -322,7 +322,7 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { linking_context: self.index.find_implementation_by_name(&implementation.name).ok_or_else( || { Diagnostic::codegen_error( - &format!("Could not find implementation for {}", &implementation.name), + format!("Could not find implementation for {}", &implementation.name), implementation.location.clone(), ) }, @@ -431,7 +431,7 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { } None => Ok(self.llvm.context.void_type().fn_type(¶ms, is_var_args)), _ => Err(Diagnostic::codegen_error( - &format!("Unsupported return type {return_type:?}"), + format!("Unsupported return type {return_type:?}"), SourceLocation::undefined(), )), } @@ -632,7 +632,7 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { let variable_llvm_type = self .llvm_index .get_associated_type(variable.get_type_name()) - .map_err(|err| Diagnostic::relocate(err, variable.source_location.clone()))?; + .map_err(|err| err.with_location(variable.source_location.clone()))?; let type_size = variable_llvm_type.size_of().ok_or_else(|| { Diagnostic::codegen_error("Couldn't determine type size", variable.source_location.clone()) diff --git a/src/codegen/generators/statement_generator.rs b/src/codegen/generators/statement_generator.rs index 0a65c636f7..6b0ed52bd5 100644 --- a/src/codegen/generators/statement_generator.rs +++ b/src/codegen/generators/statement_generator.rs @@ -322,10 +322,10 @@ impl<'a, 'b> StatementCodeGenerator<'a, 'b> { left_type, ) } else { - Err(Diagnostic::syntax_error( - &format!("{element:?} not a direct access"), - element.get_location(), - )) + //TODO: using the global context we could get a slice here + Err(Diagnostic::error(&format!("{element:?} not a direct access")) + .with_error_code("E055") + .with_location(element.get_location())) }?; for element in direct_access { let rhs_next = if let AstStatement::DirectAccess(data, ..) = element.get_stmt() { @@ -336,10 +336,10 @@ impl<'a, 'b> StatementCodeGenerator<'a, 'b> { left_type, ) } else { - Err(Diagnostic::syntax_error( - &format!("{element:?} not a direct access"), - element.get_location(), - )) + //TODO: using the global context we could get a slice here + Err(Diagnostic::error(&format!("{element:?} not a direct access")) + .with_error_code("E055") + .with_location(element.get_location())) }?; rhs = self.llvm.builder.build_int_add(rhs, rhs_next, ""); } @@ -796,7 +796,7 @@ impl<'a, 'b> StatementCodeGenerator<'a, 'b> { let value_ptr = self.llvm_index.find_loaded_associated_variable_value(ret_name).ok_or_else(|| { Diagnostic::codegen_error( - &format!("Cannot generate return variable for {call_name:}"), + format!("Cannot generate return variable for {call_name:}"), SourceLocation::undefined(), ) })?; diff --git a/src/codegen/generators/variable_generator.rs b/src/codegen/generators/variable_generator.rs index 82f2413c70..6df81c9ced 100644 --- a/src/codegen/generators/variable_generator.rs +++ b/src/codegen/generators/variable_generator.rs @@ -9,8 +9,7 @@ use crate::{ use indexmap::IndexSet; use inkwell::{module::Module, values::GlobalValue}; use plc_ast::ast::LinkageType; -use plc_diagnostics::{diagnostics::Diagnostic, errno::ErrNo}; -use plc_source::source_location::SourceLocation; +use plc_diagnostics::diagnostics::Diagnostic; use super::{ data_type_generator::get_default_for, @@ -80,8 +79,10 @@ impl<'ctx, 'b> VariableGenerator<'ctx, 'b> { if !variable.is_in_unit(location) { LinkageType::External } else { variable.get_linkage() }; let global_variable = self.generate_global_variable(variable, linkage).map_err(|err| match err.get_type() { - ErrNo::codegen__missing_function | ErrNo::reference__unresolved => { - Diagnostic::cannot_generate_initializer(name, SourceLocation::undefined()) + "E072" | "E048" => { + Diagnostic::error(format!("Cannot generate literal initializer for `{name}`.")) + .with_error_code("E041") + .with_sub_diagnostic(err) } _ => err, })?; diff --git a/src/codegen/tests/switch_case_tests.rs b/src/codegen/tests/switch_case_tests.rs index 8ba6841ca0..0ead01653a 100644 --- a/src/codegen/tests/switch_case_tests.rs +++ b/src/codegen/tests/switch_case_tests.rs @@ -42,7 +42,7 @@ fn switch_case_duplicate_integer_literal_integer() { assert_eq!( Diagnostic::GeneralError { message: "Duplicate integer as switch case\n switch i32 %load_input, label %else [\n i32 2, label %case\n i32 2, label %case1\n ]\ni32 2\n".into(), - err_no: crate::diagnostics::ErrNo::codegen__general, + err_no: "E071", }, msg ) @@ -76,7 +76,7 @@ fn switch_case_duplicate_integer_literal_integer_and_const() { assert_eq!( Diagnostic::GeneralError { message: "Duplicate integer as switch case\n switch i32 %load_input, label %else [\n i32 2, label %case\n i32 2, label %case1\n ]\ni32 2\n".into(), - err_no: crate::diagnostics::ErrNo::codegen__general, + err_no: "E071", }, msg ) @@ -106,7 +106,7 @@ fn switch_case_duplicate_integer_literal_integer_and_binary_expression() { assert_eq!( Diagnostic::GeneralError { message: "Duplicate integer as switch case\n switch i32 %load_input, label %else [\n i32 2, label %case\n i32 2, label %case1\n ]\ni32 2\n".into(), - err_no: crate::diagnostics::ErrNo::codegen__general, + err_no: "E071", }, msg ) @@ -142,7 +142,7 @@ fn switch_case_duplicate_integer_const() { assert_eq!( Diagnostic::GeneralError { message: "Duplicate integer as switch case\n switch i32 %load_input, label %else [\n i32 2, label %case\n i32 2, label %case1\n ]\ni32 2\n".into(), - err_no: crate::diagnostics::ErrNo::codegen__general, + err_no: "E071", }, msg ) @@ -176,7 +176,7 @@ fn switch_case_duplicate_integer_const_and_binary_expression() { assert_eq!( Diagnostic::GeneralError { message: "Duplicate integer as switch case\n switch i32 %load_input, label %else [\n i32 2, label %case\n i32 2, label %case1\n ]\ni32 2\n".into(), - err_no: crate::diagnostics::ErrNo::codegen__general, + err_no: "E071", }, msg ) @@ -206,7 +206,7 @@ fn switch_case_duplicate_integer_binary_expression() { assert_eq!( Diagnostic::GeneralError { message: "Duplicate integer as switch case\n switch i32 %load_input, label %else [\n i32 2, label %case\n i32 2, label %case1\n ]\ni32 2\n".into(), - err_no: crate::diagnostics::ErrNo::codegen__general, + err_no: "E071", }, msg ) diff --git a/src/hardware_binding.rs b/src/hardware_binding.rs index c16f73fdd8..fc000e5d58 100644 --- a/src/hardware_binding.rs +++ b/src/hardware_binding.rs @@ -1,5 +1,5 @@ use plc_ast::ast::{DirectAccessType, HardwareAccessType}; -use plc_diagnostics::{diagnostics::Diagnostic, errno::ErrNo}; +use plc_diagnostics::diagnostics::Diagnostic; use serde::{ ser::{SerializeSeq, SerializeStruct}, Serialize, Serializer, @@ -142,7 +142,7 @@ pub fn collect_hardware_configuration(index: &Index) -> Result Result { match format { - ConfigFormat::JSON => serde_json::to_string_pretty(&config) - .map_err(|e| Diagnostic::GeneralError { message: e.to_string(), err_no: ErrNo::general__io_err }), - ConfigFormat::TOML => toml::ser::to_string_pretty(&config) - .map_err(|e| Diagnostic::GeneralError { message: e.to_string(), err_no: ErrNo::general__io_err }), + ConfigFormat::JSON => serde_json::to_string_pretty(&config).map_err(|e| { + Diagnostic::error(e.to_string()).with_error_code("E002").with_internal_error(e.into()) + }), + ConfigFormat::TOML => toml::ser::to_string_pretty(&config).map_err(|e| { + Diagnostic::error(e.to_string()).with_error_code("E002").with_internal_error(e.into()) + }), } } diff --git a/src/index/visitor.rs b/src/index/visitor.rs index bc34fc3ca9..90de61de71 100644 --- a/src/index/visitor.rs +++ b/src/index/visitor.rs @@ -668,12 +668,12 @@ fn visit_array( Ok(Dimension { start_offset: TypeSize::from_expression(constants.add_constant_expression( *start.clone(), - typesystem::INT_TYPE.to_string(), + typesystem::DINT_TYPE.to_string(), scope.clone(), )), end_offset: TypeSize::from_expression(constants.add_constant_expression( *end.clone(), - typesystem::INT_TYPE.to_string(), + typesystem::DINT_TYPE.to_string(), scope.clone(), )), }) diff --git a/src/lexer.rs b/src/lexer.rs index 7e6e066dd7..ceff7102df 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -142,10 +142,14 @@ impl<'a> ParseSession<'a> { | Token::KeywordEndMethod | Token::KeywordEndClass => { if !self.slice().to_string().contains('_') { - self.accept_diagnostic(Diagnostic::ImprovementSuggestion { - message: format!("the words in {} should be separated by a '_'", self.slice()), - range: vec![self.location()], - }); + self.accept_diagnostic( + Diagnostic::warning(format!( + "the words in {} should be separated by a `_`", + self.slice() + )) + .with_error_code("E013") + .with_location(self.location()), + ); } } _ => {} diff --git a/src/lexer/tests/lexer_tests.rs b/src/lexer/tests/lexer_tests.rs index eff07b213e..1befe8edc7 100644 --- a/src/lexer/tests/lexer_tests.rs +++ b/src/lexer/tests/lexer_tests.rs @@ -794,10 +794,10 @@ fn multi_named_keywords_without_underscore_test() { let d1 = lexer.diagnostics.first().unwrap(); let d2 = lexer.diagnostics.last().unwrap(); - assert_eq!(d1.get_message(), "the words in VARINPUT should be separated by a '_'"); + assert_eq!(d1.get_message(), "the words in VARINPUT should be separated by a `_`"); assert_eq!(d1.get_location().to_range().unwrap(), (0..8)); - assert_eq!(d2.get_message(), "the words in ENDREPEAT should be separated by a '_'"); + assert_eq!(d2.get_message(), "the words in ENDREPEAT should be separated by a `_`"); assert_eq!(d2.get_location().to_range().unwrap(), (191..200)); } diff --git a/src/linker.rs b/src/linker.rs index 5ed9635077..4ece1cf0de 100644 --- a/src/linker.rs +++ b/src/linker.rs @@ -205,15 +205,20 @@ pub enum LinkerError { Path(PathBuf), } +//TODO: This should be of type error, or we should be using anyhow/thiserror here impl From for Diagnostic { fn from(error: LinkerError) -> Self { match error { - LinkerError::Link(e) => Diagnostic::link_error(&e), + LinkerError::Link(e) => { + Diagnostic::error(format!("An error occurred during linking: {e}")).with_error_code("E077") + } LinkerError::Path(path) => { - Diagnostic::link_error(&format!("path contains invalid UTF-8 characters: {}", path.display())) + Diagnostic::error(format!("path contains invalid UTF-8 characters: {}", path.display())) + .with_error_code("E077") } LinkerError::Target(tgt) => { - Diagnostic::link_error(&format!("linker not available for target platform: {tgt}")) + Diagnostic::error(format!("linker not available for target platform: {tgt}")) + .with_error_code("E077") } } } diff --git a/src/parser.rs b/src/parser.rs index 3e7a213d82..9ca95a6282 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -302,7 +302,11 @@ fn parse_type_nature(lexer: &mut ParseSession, nature: &str) -> TypeNature { "ANY_DATE" => TypeNature::Date, "__ANY_VLA" => TypeNature::__VLA, _ => { - lexer.accept_diagnostic(Diagnostic::unknown_type_nature(nature, lexer.location())); + lexer.accept_diagnostic( + Diagnostic::error(format!("Unkown type nature `{nature}`")) + .with_location(lexer.location()) + .with_error_code("E063"), + ); TypeNature::Any } } @@ -340,21 +344,42 @@ fn parse_return_type(lexer: &mut ParseSession, pou_type: &PouType) -> Option Option { if (opening_token == KeywordParensOpen && lexer.token == KeywordSquareParensClose) || (opening_token == KeywordSquareParensOpen && lexer.token == KeywordParensClose) { - lexer.accept_diagnostic(Diagnostic::ImprovementSuggestion { - message: "Mismatched types of parentheses around string size expression".into(), - range: vec![error_range], - }); + lexer.accept_diagnostic( + Diagnostic::error("Mismatched types of parentheses around string size expression") + .with_location(error_range) + .with_error_code("E009"), + ); } else if opening_token == KeywordParensOpen || lexer.token == KeywordParensClose { - lexer.accept_diagnostic(Diagnostic::ImprovementSuggestion { - message: "Unusual type of parentheses around string size expression, consider using square parentheses '[]'" - .into(), - range: vec![error_range], - }); + lexer.accept_diagnostic(Diagnostic::warning( + "Unusual type of parentheses around string size expression, consider using square parentheses '[]'"). + with_location(error_range) + .with_error_code("E014") + ); } Some(size_expr) @@ -871,7 +898,11 @@ fn parse_array_type_definition( let is_variable_length = match is_variable_length { Some(val) => val, None => { - Diagnostic::invalid_range_statement(&range, range.get_location()); + lexer.accept_diagnostic( + Diagnostic::error(format!("Expected a range statement, got {range:?} instead")) + .with_location(range.get_location()) + .with_error_code("E008"), + ); false } }; @@ -965,10 +996,11 @@ fn parse_variable_block_type(lexer: &mut ParseSession) -> VariableBlockType { let argument_property = if lexer.try_consume(&PropertyByRef) { //Report a diagnostic if blocktype is incompatible if !matches!(block_type, KeywordVarInput) { - lexer.accept_diagnostic(Diagnostic::invalid_pragma_location( - "Only VAR_INPUT support by ref properties", - lexer.location(), - )) + lexer.accept_diagnostic( + Diagnostic::warning("Invalid pragma location: Only VAR_INPUT support by ref properties") + .with_error_code("E024") + .with_location(lexer.location()), + ) } ArgumentProperty::ByRef } else { diff --git a/src/parser/control_parser.rs b/src/parser/control_parser.rs index ce42bf94b9..c1feca1c45 100644 --- a/src/parser/control_parser.rs +++ b/src/parser/control_parser.rs @@ -182,10 +182,11 @@ fn parse_case_statement(lexer: &mut ParseSession) -> AstNode { } else { //If no current condition is available, log a diagnostic and add an empty condition if current_condition.is_none() { - lexer.accept_diagnostic(Diagnostic::syntax_error( - "Missing Case-Condition", - lexer.location(), - )); + lexer.accept_diagnostic( + Diagnostic::error("Missing Case-Condition") + .with_error_code("E012") + .with_location(lexer.location()), + ); current_condition = Some(Box::new(AstFactory::create_empty_statement(lexer.location(), lexer.next_id()))); } diff --git a/src/parser/expressions_parser.rs b/src/parser/expressions_parser.rs index 8576144282..2131dfa37d 100644 --- a/src/parser/expressions_parser.rs +++ b/src/parser/expressions_parser.rs @@ -523,10 +523,10 @@ fn parse_literal_number(lexer: &mut ParseSession, is_negative: bool) -> Result().map_err(|e| { - Diagnostic::syntax_error( - format!("{e}").as_str(), - lexer.source_range_factory.create_range(location), - ) + Diagnostic::error(format!("Failed parsing number {result}")) + .with_error_code("E011") + .with_location(lexer.source_range_factory.create_range(location)) + .with_internal_error(e.into()) })?; let element = parse_expression(lexer); lexer.expect(KeywordParensClose)?; @@ -570,7 +570,9 @@ pub fn parse_strict_literal_integer(lexer: &mut ParseSession) -> Result(text: &str, location: &SourceLocation) -> Result { text.parse::().map_err(|_| { - Diagnostic::syntax_error(format!("Failed parsing number {text}").as_str(), location.clone()) + Diagnostic::error(format!("Failed parsing number {text}")) + .with_error_code("E011") + .with_location(location.clone()) }) } @@ -693,7 +695,9 @@ fn parse_literal_time(lexer: &mut ParseSession) -> Result { //just eat all the digits char = chars.find(|(_, ch)| !ch.is_ascii_digit() && !ch.eq(&'.')); char.ok_or_else(|| { - Diagnostic::syntax_error("Invalid TIME Literal: Cannot parse segment.", location.clone()) + Diagnostic::error("Invalid TIME Literal: Cannot parse segment.") + .with_error_code("E010") + .with_location(location.clone()) }) .and_then(|(index, _)| parse_number::(&slice[start..index], &location))? }; @@ -701,10 +705,9 @@ fn parse_literal_time(lexer: &mut ParseSession) -> Result { //expect a unit let unit = { let start = char.map(|(index, _)| index).ok_or_else(|| { - Diagnostic::syntax_error( - "Invalid TIME Literal: Missing unit (d|h|m|s|ms|us|ns)", - location.clone(), - ) + Diagnostic::error("Invalid TIME Literal: Missing unit (d|h|m|s|ms|us|ns)") + .with_error_code("E010") + .with_location(location.clone()) })?; //just eat all the characters @@ -727,25 +730,22 @@ fn parse_literal_time(lexer: &mut ParseSession) -> Result { if let Some(position) = position { //check if we assign out of order - every assignment before must have been a smaller position if prev_pos > position { - return Err(Diagnostic::syntax_error( - "Invalid TIME Literal: segments out of order, use d-h-m-s-ms", - location, - )); + return Err(Diagnostic::error("Invalid TIME Literal: segments out of order, use d-h-m-s-ms") + .with_error_code("E010") + .with_location(location)); } prev_pos = position; //remember that we wrote this position if values[position].is_some() { - return Err(Diagnostic::syntax_error( - "Invalid TIME Literal: segments must be unique", - location, - )); + return Err(Diagnostic::error("Invalid TIME Literal: segments must be unique") + .with_error_code("E010") + .with_location(location)); } values[position] = Some(number); //store the number } else { - return Err(Diagnostic::syntax_error( - format!("Invalid TIME Literal: illegal unit '{unit}'").as_str(), - location, - )); + return Err(Diagnostic::error(format!("Invalid TIME Literal: illegal unit '{unit}'")) + .with_error_code("E010") + .with_location(location)); } } diff --git a/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_containers_tests__function_return_type_with_initializer.snap b/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_containers_tests__function_return_type_with_initializer.snap index 6c9d44d6b9..008ff486e1 100644 --- a/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_containers_tests__function_return_type_with_initializer.snap +++ b/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_containers_tests__function_return_type_with_initializer.snap @@ -2,10 +2,10 @@ source: src/parser/tests/parse_errors/parse_error_containers_tests.rs expression: diagnostics --- -error: Return types cannot have a default value +warning: Return types cannot have a default value, the value will be ignored ┌─ :2:35 │ 2 │ FUNCTION foo : INT := 3 - │ ^ Return types cannot have a default value + │ ^ Return types cannot have a default value, the value will be ignored diff --git a/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_literals_tests__string_with_round_parens_can_be_parsed.snap b/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_literals_tests__string_with_round_parens_can_be_parsed.snap index 6dcdfbc038..6104250513 100644 --- a/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_literals_tests__string_with_round_parens_can_be_parsed.snap +++ b/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_literals_tests__string_with_round_parens_can_be_parsed.snap @@ -8,13 +8,13 @@ warning: Unusual type of parentheses around string size expression, consider usi 2 │ TYPE MyString1 : STRING(253); END_TYPE │ ^^^^ Unusual type of parentheses around string size expression, consider using square parentheses '[]' -warning: Mismatched types of parentheses around string size expression +error: Mismatched types of parentheses around string size expression ┌─ :3:37 │ 3 │ TYPE MyString2 : STRING[254) := 'abc'; END_TYPE │ ^^^^ Mismatched types of parentheses around string size expression -warning: Mismatched types of parentheses around string size expression +error: Mismatched types of parentheses around string size expression ┌─ :4:37 │ 4 │ TYPE MyString3 : STRING(255]; END_TYPE diff --git a/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_statements_tests__pointer_type_with_wrong_keyword_to_test.snap b/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_statements_tests__pointer_type_with_wrong_keyword_to_test.snap index b937c33306..36719f3515 100644 --- a/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_statements_tests__pointer_type_with_wrong_keyword_to_test.snap +++ b/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_statements_tests__pointer_type_with_wrong_keyword_to_test.snap @@ -2,11 +2,11 @@ source: src/parser/tests/parse_errors/parse_error_statements_tests.rs expression: diagnostics --- -warning: 'POINTER TO' is not a standard keyword, use REF_TO instead +warning: `POINTER TO` is not a standard keyword, use `REF_TO` instead ┌─ :3:13 │ 3 │ POINTER tu INT; - │ ^^^^^^^ 'POINTER TO' is not a standard keyword, use REF_TO instead + │ ^^^^^^^ `POINTER TO` is not a standard keyword, use `REF_TO` instead error: Unexpected token: expected KeywordTo but found tu ┌─ :3:21 diff --git a/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_statements_tests__pointer_type_without_to_test.snap b/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_statements_tests__pointer_type_without_to_test.snap index 0c9778ff66..2adf21ddeb 100644 --- a/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_statements_tests__pointer_type_without_to_test.snap +++ b/src/parser/tests/parse_errors/snapshots/rusty__parser__tests__parse_errors__parse_error_statements_tests__pointer_type_without_to_test.snap @@ -2,11 +2,11 @@ source: src/parser/tests/parse_errors/parse_error_statements_tests.rs expression: diagnostics --- -warning: 'POINTER TO' is not a standard keyword, use REF_TO instead +warning: `POINTER TO` is not a standard keyword, use `REF_TO` instead ┌─ :3:13 │ 3 │ POINTER INT; - │ ^^^^^^^ 'POINTER TO' is not a standard keyword, use REF_TO instead + │ ^^^^^^^ `POINTER TO` is not a standard keyword, use `REF_TO` instead error: Unexpected token: expected KeywordTo but found INT ┌─ :3:21 diff --git a/src/parser/tests/snapshots/rusty__parser__tests__container_parser_tests__actions_with_invalid_token.snap b/src/parser/tests/snapshots/rusty__parser__tests__container_parser_tests__actions_with_invalid_token.snap index 99974e4e73..828af6a8e9 100644 --- a/src/parser/tests/snapshots/rusty__parser__tests__container_parser_tests__actions_with_invalid_token.snap +++ b/src/parser/tests/snapshots/rusty__parser__tests__container_parser_tests__actions_with_invalid_token.snap @@ -2,22 +2,24 @@ source: src/parser/tests/container_parser_tests.rs expression: errors.first().unwrap() --- -SyntaxError { +Diagnostic { message: "Unexpected token: expected KeywordAction but found BRAVO", - range: [ - SourceLocation { - span: Range( - TextLocation { - line: 0, - column: 13, - offset: 13, - }..TextLocation { - line: 0, - column: 18, - offset: 18, - }, - ), - }, - ], - err_no: syntax__unexpected_token, + primary_location: SourceLocation { + span: Range( + TextLocation { + line: 0, + column: 13, + offset: 13, + }..TextLocation { + line: 0, + column: 18, + offset: 18, + }, + ), + }, + secondary_locations: None, + severity: Error, + error_code: "E007", + sub_diagnostics: [], + internal_error: None, } diff --git a/src/parser/tests/snapshots/rusty__parser__tests__function_parser_tests__function_inline_enum_return_unsupported.snap b/src/parser/tests/snapshots/rusty__parser__tests__function_parser_tests__function_inline_enum_return_unsupported.snap index 34c6bc91b4..c9422d9bfe 100644 --- a/src/parser/tests/snapshots/rusty__parser__tests__function_parser_tests__function_inline_enum_return_unsupported.snap +++ b/src/parser/tests/snapshots/rusty__parser__tests__function_parser_tests__function_inline_enum_return_unsupported.snap @@ -2,10 +2,10 @@ source: src/parser/tests/function_parser_tests.rs expression: diagnostics --- -error: Data Type DataTypeDefinition { data_type: EnumType { name: None, numeric_type: "DINT", elements: ExpressionList { expressions: [ReferenceExpr { kind: Member(Identifier { name: "green" }), base: None }, ReferenceExpr { kind: Member(Identifier { name: "yellow" }), base: None }, ReferenceExpr { kind: Member(Identifier { name: "red" }), base: None }] } } } not supported as a function return type! +error: Data Type (green, yellow, red) not supported as a function return type! ┌─ :1:16 │ 1 │ FUNCTION foo : (green, yellow, red) VAR_INPUT END_VAR END_FUNCTION - │ ^^^^^^^^^^^^^^^^^^^^ Data Type DataTypeDefinition { data_type: EnumType { name: None, numeric_type: "DINT", elements: ExpressionList { expressions: [ReferenceExpr { kind: Member(Identifier { name: "green" }), base: None }, ReferenceExpr { kind: Member(Identifier { name: "yellow" }), base: None }, ReferenceExpr { kind: Member(Identifier { name: "red" }), base: None }] } } } not supported as a function return type! + │ ^^^^^^^^^^^^^^^^^^^^ Data Type (green, yellow, red) not supported as a function return type! diff --git a/src/parser/tests/snapshots/rusty__parser__tests__function_parser_tests__function_inline_struct_return_unsupported.snap b/src/parser/tests/snapshots/rusty__parser__tests__function_parser_tests__function_inline_struct_return_unsupported.snap index ab09be8ccd..24ff9692db 100644 --- a/src/parser/tests/snapshots/rusty__parser__tests__function_parser_tests__function_inline_struct_return_unsupported.snap +++ b/src/parser/tests/snapshots/rusty__parser__tests__function_parser_tests__function_inline_struct_return_unsupported.snap @@ -2,11 +2,11 @@ source: src/parser/tests/function_parser_tests.rs expression: diagnostics --- -error: Data Type DataTypeDefinition { data_type: StructType { name: None, variables: [Variable { name: "x", data_type: DataTypeReference { referenced_type: "INT" } }, Variable { name: "y", data_type: DataTypeReference { referenced_type: "INT" } }] } } not supported as a function return type! +error: Data Type STRUCT x : INT; y : INT; END_STRUCT not supported as a function return type! ┌─ :1:16 │ 1 │ FUNCTION foo : STRUCT x : INT; y : INT; END_STRUCT VAR_INPUT END_VAR END_FUNCTION - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data Type DataTypeDefinition { data_type: StructType { name: None, variables: [Variable { name: "x", data_type: DataTypeReference { referenced_type: "INT" } }, Variable { name: "y", data_type: DataTypeReference { referenced_type: "INT" } }] } } not supported as a function return type! + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data Type STRUCT x : INT; y : INT; END_STRUCT not supported as a function return type! error: Unexpected token: expected Literal but found END_STRUCT ┌─ :1:41 diff --git a/src/parser/tests/snapshots/rusty__parser__tests__type_parser_tests__global_pointer_declaration-3.snap b/src/parser/tests/snapshots/rusty__parser__tests__type_parser_tests__global_pointer_declaration-3.snap index 5ba7f938d2..0f55cbd50f 100644 --- a/src/parser/tests/snapshots/rusty__parser__tests__type_parser_tests__global_pointer_declaration-3.snap +++ b/src/parser/tests/snapshots/rusty__parser__tests__type_parser_tests__global_pointer_declaration-3.snap @@ -2,10 +2,10 @@ source: src/parser/tests/type_parser_tests.rs expression: diagnostics --- -warning: 'POINTER TO' is not a standard keyword, use REF_TO instead +warning: `POINTER TO` is not a standard keyword, use `REF_TO` instead ┌─ :4:29 │ 4 │ SamplePointer : POINTER TO INT; - │ ^^^^^^^ 'POINTER TO' is not a standard keyword, use REF_TO instead + │ ^^^^^^^ `POINTER TO` is not a standard keyword, use `REF_TO` instead diff --git a/src/resolver/const_evaluator.rs b/src/resolver/const_evaluator.rs index a108adcf80..cfda5b1bcf 100644 --- a/src/resolver/const_evaluator.rs +++ b/src/resolver/const_evaluator.rs @@ -562,7 +562,7 @@ fn resolve_const_reference( index: &Index, ) -> Result, UnresolvableKind> { if !variable.is_constant() { - return Err(UnresolvableKind::Misc(format!("'{name}' is no const reference"))); + return Err(UnresolvableKind::Misc(format!("`{name}` is no const reference"))); } if let Some(ConstExpression::Resolved(statement)) = diff --git a/src/resolver/tests/const_resolver_tests.rs b/src/resolver/tests/const_resolver_tests.rs index d5ac99e58d..5fd4a3cf8a 100644 --- a/src/resolver/tests/const_resolver_tests.rs +++ b/src/resolver/tests/const_resolver_tests.rs @@ -228,9 +228,9 @@ fn non_const_references_to_int_compile_time_evaluation() { debug_assert_eq!( vec![ - UnresolvableConstant::new(global!(index, "nok_a"), "'a' is no const reference"), - UnresolvableConstant::new(global!(index, "nok_b"), "'b' is no const reference"), - UnresolvableConstant::new(global!(index, "temp"), "'a' is no const reference"), + UnresolvableConstant::new(global!(index, "nok_a"), "`a` is no const reference"), + UnresolvableConstant::new(global!(index, "nok_b"), "`b` is no const reference"), + UnresolvableConstant::new(global!(index, "temp"), "`a` is no const reference"), UnresolvableConstant::incomplete_initialzation(&global!(index, "incomplete")), //this one is fine, but one depency cannot be resolved ], unresolvable diff --git a/src/resolver/tests/resolve_literals_tests.rs b/src/resolver/tests/resolve_literals_tests.rs index 5997737c1e..790ae527de 100644 --- a/src/resolver/tests/resolve_literals_tests.rs +++ b/src/resolver/tests/resolve_literals_tests.rs @@ -545,7 +545,7 @@ fn struct_field_members_assignments_are_annotated_correctly_in_array_of_structs( // x := 0 let x = &elements[0]; - assert_eq!(&annotations.get_type_hint(&x, &index).unwrap().name, "STRUCT1"); + assert_eq!(&annotations.get_type_hint(x, &index).unwrap().name, "STRUCT1"); // arr := [(y := 0), (z := 0)] let AstStatement::Assignment(assignment) = &elements[1].stmt else { panic!() }; @@ -556,9 +556,9 @@ fn struct_field_members_assignments_are_annotated_correctly_in_array_of_structs( // y := 0 let AstStatement::ParenExpression(y) = &elements[0].stmt else { panic!() }; - assert_eq!(&annotations.get_type_hint(&y, &index).unwrap().name, "STRUCT2"); + assert_eq!(&annotations.get_type_hint(y, &index).unwrap().name, "STRUCT2"); // z := 0 let AstStatement::ParenExpression(z) = &elements[1].stmt else { panic!() }; - assert_eq!(&annotations.get_type_hint(&z, &index).unwrap().name, "STRUCT2"); + assert_eq!(&annotations.get_type_hint(z, &index).unwrap().name, "STRUCT2"); } diff --git a/src/typesystem.rs b/src/typesystem.rs index e97cdd34d7..df5bc6b53d 100644 --- a/src/typesystem.rs +++ b/src/typesystem.rs @@ -171,6 +171,10 @@ impl DataType { self.get_type_information().is_vla() } + pub fn is_pointer(&self) -> bool { + self.get_type_information().is_pointer() + } + /// returns true if this type is an array, struct or string pub fn is_aggregate_type(&self) -> bool { self.get_type_information().is_aggregate() diff --git a/src/validation.rs b/src/validation.rs index d1038b6ca6..6c5e058550 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -143,7 +143,9 @@ impl<'a> Validator<'a> { continue; }; - self.push_diagnostic(Diagnostic::overflow(reason.to_owned(), location.to_owned())); + self.push_diagnostic( + Diagnostic::warning(reason).with_error_code("E038").with_location(location.to_owned()), + ); } } diff --git a/src/validation/array.rs b/src/validation/array.rs index baa2038ea0..509a3c8274 100644 --- a/src/validation/array.rs +++ b/src/validation/array.rs @@ -69,7 +69,11 @@ fn validate_array( ) { let stmt_rhs = peel(rhs_stmt); if !(stmt_rhs.is_literal_array() || stmt_rhs.is_reference() || stmt_rhs.is_call()) { - validator.push_diagnostic(Diagnostic::array_assignment(stmt_rhs.get_location())); + validator.push_diagnostic( + Diagnostic::error("Array assignments must be surrounded with `[]`") + .with_error_code("E043") + .with_location(stmt_rhs.get_location()), + ); return; // Return here, because array size validation is error-prone with incorrect assignments } @@ -83,7 +87,13 @@ fn validate_array( if len_lhs < len_rhs { let name = statement.lhs_name(validator.context); let location = stmt_rhs.get_location(); - validator.push_diagnostic(Diagnostic::array_size(&name, len_lhs, len_rhs, location)); + validator.push_diagnostic( + Diagnostic::error(format!( + "Array `{name}` has a size of {len_lhs}, but {len_rhs} elements were provided" + )) + .with_error_code("E043") + .with_location(location), + ); } } @@ -105,13 +115,21 @@ fn validate_array_of_structs( match elements { AstStatement::ExpressionList(expressions) => { for invalid in expressions.iter().filter(|it| !it.is_paren()) { - validator.push_diagnostic(Diagnostic::array_struct_assignment(invalid.get_location())); + validator.push_diagnostic( + Diagnostic::error("Struct initializers within arrays have to be wrapped by `()`") + .with_error_code("E043") + .with_location(invalid.get_location()), + ); } } // arr := [foo := 0] AstStatement::Assignment(..) => { - validator.push_diagnostic(Diagnostic::array_struct_assignment(rhs_stmt.get_location())); + validator.push_diagnostic( + Diagnostic::error("Struct initializers within arrays have to be wrapped by `()`") + .with_error_code("E043") + .with_location(rhs_stmt.get_location()), + ); } _ => (), diff --git a/src/validation/global.rs b/src/validation/global.rs index 6672334fde..b620015c49 100644 --- a/src/validation/global.rs +++ b/src/validation/global.rs @@ -34,30 +34,29 @@ impl GlobalValidator { locations: &[&SourceLocation], additional_text: Option<&str>, ) { - for (idx, v) in locations.iter().enumerate() { - let others = locations - .iter() - .enumerate() - .filter(|(j, _)| idx != (*j)) - .map(|(_, it)| (*it).clone()) - .collect::>(); + for v in locations.iter() { + let others = locations.iter().filter(|it| *it != v).map(|it| (*it).clone()).collect::>(); // If the SourceRange of `v` is undefined, we can assume the user choose a name which clashes // with an (internal) built-in datatype, hence the undefined location. if v.is_undefined() { - self.diagnostics.push(Diagnostic::invalid_type_name(name, others)); - continue; // Skip this iteration, otherwise we would also report an internal error - } - - if let Some(additional_text) = additional_text { - self.push_diagnostic(Diagnostic::global_name_conflict_with_text( - name, - (*v).clone(), - others, - additional_text, - )); + for other in others { + self.diagnostics.push( + Diagnostic::error(format!( + "{name} can not be used as a name because it is a built-in datatype" + )) + .with_location((other).clone()) + .with_error_code("E004"), + ); + } } else { - self.push_diagnostic(Diagnostic::global_name_conflict(name, (*v).clone(), others)); + let additional_text = additional_text.unwrap_or("Duplicate symbol."); + self.push_diagnostic( + Diagnostic::error(format!("{name}: {additional_text}")) + .with_error_code("E004") + .with_location((*v).clone()) + .with_secondary_locations(others), + ); } } } diff --git a/src/validation/pou.rs b/src/validation/pou.rs index 3105682098..19227aa7d9 100644 --- a/src/validation/pou.rs +++ b/src/validation/pou.rs @@ -22,14 +22,16 @@ pub fn visit_implementation( context: &ValidationContext<'_, T>, ) { if implementation.pou_type == PouType::Class && !implementation.statements.is_empty() { - validator.push_diagnostic(Diagnostic::syntax_error( - "A class cannot have an implementation", - implementation.location.to_owned(), - )); + validator.push_diagnostic( + Diagnostic::error("A class cannot have an implementation") + .with_error_code("E017") + .with_location(implementation.location.to_owned()), + ); } if implementation.linkage != LinkageType::External { validate_action_container(validator, implementation); - //Validate the label uniquiness + //Validate the label uniqueness + if let Some(labels) = context.index.get_labels(&implementation.name) { for (_, labels) in labels.entries() { let mut label_iter = labels.iter(); @@ -39,11 +41,12 @@ pub fn visit_implementation( let mut locations: Vec<_> = label_iter.map(|it| it.location.clone()).collect(); locations.push(first.location.clone()); locations.push(second.location.clone()); - validator.push_diagnostic(Diagnostic::duplicate_label( - &first.name, - first.location.clone(), - locations, - )); + validator.push_diagnostic( + Diagnostic::error(format!("{}: Duplicate label.", &first.name)) + .with_error_code("E018") + .with_location(first.location.clone()) + .with_secondary_locations(locations), + ); } } } @@ -68,55 +71,68 @@ fn validate_pou(validator: &mut Validator, pou: &Pou, context: fn validate_class(validator: &mut Validator, pou: &Pou, context: &ValidationContext) { // var in/out/inout blocks are not allowed inside of class declaration + // TODO: This should be on each block if pou.variable_blocks.iter().any(|it| { matches!( it.variable_block_type, VariableBlockType::InOut | VariableBlockType::Input(_) | VariableBlockType::Output ) }) { - validator.push_diagnostic(Diagnostic::syntax_error( - "A class cannot have a var in/out/inout blocks", - pou.name_location.to_owned(), - )); + validator.push_diagnostic( + Diagnostic::error("A class cannot have a var in/out/inout blocks") + .with_error_code("E019") + .with_location(pou.name_location.to_owned()), + ); } // classes cannot have a return type if context.index.find_return_type(&pou.name).is_some() { - validator.push_diagnostic(Diagnostic::syntax_error( - "A class cannot have a return type", - pou.name_location.to_owned(), - )); + validator.push_diagnostic( + Diagnostic::error("A class cannot have a return type") + .with_error_code("E020") + .with_location(pou.name_location.clone()), + ); } } fn validate_function(validator: &mut Validator, pou: &Pou, context: &ValidationContext) { // functions cannot use EXTENDS if pou.super_class.is_some() { - validator.push_diagnostic(Diagnostic::syntax_error( - "A function cannot use EXTEND", - pou.name_location.to_owned(), - )); + validator.push_diagnostic( + Diagnostic::error("A function cannot use `EXTEND`") + .with_error_code("E021") + .with_location(pou.name_location.to_owned()), + ); } let return_type = context.index.find_return_type(&pou.name); // functions must have a return type if return_type.is_none() { - validator.push_diagnostic(Diagnostic::function_return_missing(pou.name_location.to_owned())); + validator.push_diagnostic( + Diagnostic::error("Function Return type missing") + .with_error_code("E025") + .with_location(pou.name_location.clone()), + ); } } fn validate_program(validator: &mut Validator, pou: &Pou) { // programs cannot use EXTENDS if pou.super_class.is_some() { - validator.push_diagnostic(Diagnostic::syntax_error( - "A program cannot use EXTEND", - pou.name_location.to_owned(), - )); + validator.push_diagnostic( + Diagnostic::error("A program cannot use `EXTEND`") + .with_error_code("E021") + .with_location(pou.name_location.to_owned()), + ); } } pub fn validate_action_container(validator: &mut Validator, implementation: &Implementation) { if implementation.pou_type == PouType::Action && implementation.type_name == "__unknown__" { - validator.push_diagnostic(Diagnostic::missing_action_container(implementation.location.clone())); + validator.push_diagnostic( + Diagnostic::warning("Missing Actions Container Name") + .with_error_code("E022") + .with_location(implementation.location.clone()), + ); } } diff --git a/src/validation/recursive.rs b/src/validation/recursive.rs index b48a3aa1f8..96ff19b7ba 100644 --- a/src/validation/recursive.rs +++ b/src/validation/recursive.rs @@ -103,11 +103,26 @@ impl RecursiveValidator { match path.get_index_of(node) { Some(idx) => { let mut slice = path.iter().skip(idx).copied().collect::>(); - let ranges = slice.iter().map(|node| node.location.to_owned()).collect(); + let ranges = slice.iter().map(|node| node.location.to_owned()).collect::>(); slice.push(node); // Append to get `B -> C -> B` instead of `B -> C` in the report let error = slice.iter().map(|it| it.get_name()).join(" -> "); - self.diagnostics.push(Diagnostic::recursive_datastructure(&error, ranges)); + let diagnostic = + Diagnostic::error(format!("Recursive data structure `{}` has infinite size", error)) + .with_error_code("E029"); + + let diagnostic = if let Some(first) = ranges.first() { + diagnostic.with_location(first.clone()) + } else { + diagnostic + }; + + let diagnostic = if ranges.len() > 1 { + ranges.iter().fold(diagnostic, |prev, it| prev.with_secondary_location(it.clone())) + } else { + diagnostic + }; + self.diagnostics.push(diagnostic); } None => unreachable!("Node has to be in the IndexSet"), diff --git a/src/validation/statement.rs b/src/validation/statement.rs index fc1228390b..7445fa8ba9 100644 --- a/src/validation/statement.rs +++ b/src/validation/statement.rs @@ -110,9 +110,11 @@ pub fn visit_statement( // if we get here, then a `CaseCondition` is used outside a `CaseStatement` // `CaseCondition` are used as a marker for `CaseStatements` and are not passed as such to the `CaseStatement.case_blocks` // see `control_parser` `parse_case_statement()` - validator.push_diagnostic(Diagnostic::case_condition_used_outside_case_statement( - condition.get_location(), - )); + validator.push_diagnostic( + Diagnostic::error("Case condition used outside of case statement! Did you mean to use ';'?") + .with_error_code("E079") + .with_location(condition.get_location()), + ); visit_statement(validator, condition, context); } AstStatement::JumpStatement(JumpStatement { condition, target }) => { @@ -161,10 +163,11 @@ fn validate_reference_expression( if let Some(base) = base { visit_array_access(validator, base, i, context) } else { - validator.push_diagnostic(Diagnostic::invalid_operation( - "Index-Access requires an array-value.", - statement.get_location(), - )); + validator.push_diagnostic( + Diagnostic::error("Index-Access requires an array-value.") + .with_error_code("E069") + .with_location(statement.get_location()), + ); } } ReferenceAccess::Cast(c) => { @@ -186,20 +189,22 @@ fn validate_reference_expression( } ReferenceAccess::Deref => { if base.is_none() { - validator.diagnostics.push(Diagnostic::invalid_operation( - "Dereferencing requires a pointer-value.", - statement.get_location(), - )); + validator.diagnostics.push( + Diagnostic::error("Dereferencing requires a pointer-value.") + .with_error_code("E068") + .with_location(statement.get_location()), + ); } } ReferenceAccess::Address => { if let Some(base) = base { validate_address_of_expression(validator, base, statement.get_location(), context); } else { - validator.diagnostics.push(Diagnostic::invalid_operation( - "Address-of requires a value.", - statement.get_location(), - )); + validator.diagnostics.push( + Diagnostic::error("Address-of requires a value.") + .with_error_code("E070") + .with_location(statement.get_location()), + ); } } } @@ -217,10 +222,11 @@ fn validate_address_of_expression( } let a = context.annotations.get(target); - //TODO: resolver should also annotate information whether this results in an LValue or RValue - // array-access results in a value, but it is an LValue :-( + if !matches!(a, Some(StatementAnnotation::Variable { .. })) && !target.is_array_access() { - validator.push_diagnostic(Diagnostic::invalid_operation("Invalid address-of operation", location)); + validator.push_diagnostic( + Diagnostic::error("Invalid address-of operation").with_error_code("E066").with_location(location), + ); } } @@ -240,22 +246,17 @@ fn validate_direct_access( .get_type_for_annotation(context.index, base_annotation) .unwrap_or(context.index.get_void_type()) .get_type_information(); - if base_type.is_int() { - if !helper::is_compatible(access, base_type, context.index) { - validator.push_diagnostic(Diagnostic::incompatible_directaccess( - &format!("{access:?}"), - access.get_bit_width(), - m.get_location(), - )) - } else { - validate_access_index(validator, context, index, access, base_type, &m.get_location()); - } + if base_type.is_int() && helper::is_compatible(access, base_type, context.index) { + validate_access_index(validator, context, index, access, base_type, &m.get_location()); } else { - validator.push_diagnostic(Diagnostic::incompatible_directaccess( - &format!("{access:?}"), - access.get_bit_width(), - m.get_location(), - )) + validator.push_diagnostic( + Diagnostic::error(format!( + "{access:?}-Wise access requires a Numerical type larger than {} bits", + access.get_bit_width() + )) + .with_error_code("E055") + .with_location(m.get_location()), + ) } } } @@ -301,6 +302,22 @@ fn validate_cast_literal( location: &SourceLocation, context: &ValidationContext, ) { + fn incompatible_literal_cast( + cast_type: &str, + literal_type: &str, + location: SourceLocation, + ) -> Diagnostic { + Diagnostic::error(format!("Literal {literal_type} is not compatible to {cast_type}")) + .with_error_code("E054") + .with_location(location) + } + + fn literal_out_of_range(literal: &str, range_hint: &str, location: SourceLocation) -> Diagnostic { + Diagnostic::error(format!("Literal {literal} out of range ({range_hint})")) + .with_error_code("E053") + .with_location(location) + } + let cast_type = context.index.get_effective_type_or_void_by_name(type_name).get_type_information(); let literal_type = context.index.get_type_information_or_void( get_literal_actual_signed_type_name(literal, !cast_type.is_unsigned_int()) @@ -309,9 +326,16 @@ fn validate_cast_literal( ); if !literal.is_cast_prefix_eligible() { - validator.push_diagnostic(Diagnostic::literal_expected(location.clone())) + validator.push_diagnostic( + Diagnostic::error(format!( + "Cannot cast into {}, only elementary types are allowed", + validator.context.slice(&statement.get_location()) + )) + .with_error_code("E061") + .with_location(location.clone()), + ) } else if cast_type.is_date_or_time_type() || literal_type.is_date_or_time_type() { - validator.push_diagnostic(Diagnostic::incompatible_literal_cast( + validator.push_diagnostic(incompatible_literal_cast( cast_type.get_name(), literal_type.get_name(), location.clone(), @@ -320,7 +344,7 @@ fn validate_cast_literal( } else if cast_type.is_int() && literal_type.is_int() { // INTs with INTs if cast_type.get_semantic_size(context.index) < literal_type.get_semantic_size(context.index) { - validator.push_diagnostic(Diagnostic::literal_out_of_range( + validator.push_diagnostic(literal_out_of_range( literal.get_literal_value().as_str(), cast_type.get_name(), location.clone(), @@ -330,7 +354,7 @@ fn validate_cast_literal( let value = literal.get_literal_value(); // value contains "" / '' if value.len() > 3 { - validator.push_diagnostic(Diagnostic::literal_out_of_range( + validator.push_diagnostic(literal_out_of_range( value.as_str(), cast_type.get_name(), location.clone(), @@ -340,7 +364,7 @@ fn validate_cast_literal( // different types // REAL#100 is fine, other differences are not if !(cast_type.is_float() && literal_type.is_int()) { - validator.push_diagnostic(Diagnostic::incompatible_literal_cast( + validator.push_diagnostic(incompatible_literal_cast( cast_type.get_name(), literal.get_literal_value().as_str(), location.clone(), @@ -365,21 +389,27 @@ fn validate_access_index( target_type, context.index, ) { - validator.push_diagnostic(Diagnostic::incompatible_directaccess_range( - &format!("{access_type:?}"), - target_type.get_name(), - helper::get_range(access_type, target_type, context.index), - location.clone(), - )) + let range = helper::get_range(access_type, target_type, context.index); + validator.push_diagnostic( + Diagnostic::error(format!( + "{access_type:?}-Wise access for type {} must be in range {}..{}", + target_type.get_name(), + &range.start, + &range.end + )) + .with_error_code("E057") + .with_location(location.clone()), + ) } } AstStatement::ReferenceExpr(_) => { let ref_type = context.annotations.get_type_or_void(access_index, context.index); if !ref_type.get_type_information().is_int() { - validator.push_diagnostic(Diagnostic::incompatible_directaccess_variable( - ref_type.get_name(), - location.clone(), - )) + validator.push_diagnostic( + Diagnostic::error(format!("Invalid type {} for direct variable access. Only variables of Integer types are allowed", ref_type.get_name())) + .with_error_code("E056") + .with_location(location.clone()) + ) } } _ => unreachable!(), @@ -408,12 +438,11 @@ fn validate_reference( if base.is_some() && (alternative_target_type.is_numerical() || alternative_target_type.is_enum()) { // we accessed a member that does not exist, but we could find a global/local variable that fits - validator.push_diagnostic(Diagnostic::ImprovementSuggestion { - message: format!( - "If you meant to directly access a bit/byte/word/.., use %X/%B/%W{ref_name} instead.", - ), - range: vec![location.clone()], - }); + validator.push_diagnostic( + Diagnostic::info(format!("If you meant to directly access a bit/byte/word/..., use %X/%B/%W{ref_name} instead.")) + .with_error_code("E060") + .with_location(location.clone()) + ); } } } else if let Some(StatementAnnotation::Variable { qualified_name, argument_type, .. }) = @@ -430,7 +459,12 @@ fn validate_reference( !qualified_name.starts_with(pou) && !qualified_name.starts_with(container) }) { - validator.push_diagnostic(Diagnostic::illegal_access(qualified_name.as_str(), location.clone())); + validator.push_diagnostic( + //TODO: maybe default to warning? + Diagnostic::error(format!("Illegal access to private member {qualified_name}")) + .with_error_code("E049") + .with_location(location.clone()), + ); } } } @@ -471,16 +505,24 @@ fn visit_array_access( validate_array_access_dimensions(*ndims, dims, validator, access); } - _ => validator.push_diagnostic(Diagnostic::incompatible_array_access_variable( - target_type.get_name(), - access.get_location(), - )), + _ => validator.push_diagnostic( + Diagnostic::error(format!( + "Invalid type {} for array access. Only variables of Array types are allowed", + target_type.get_name() + )) + .with_error_code("E059") + .with_location(access.get_location()), + ), } } fn validate_array_access_dimensions(ndims: usize, dims: usize, validator: &mut Validator, access: &AstNode) { if ndims != dims { - validator.push_diagnostic(Diagnostic::invalid_array_access(ndims, dims, access.get_location())) + validator.push_diagnostic( + Diagnostic::error(format!("Expected array access with {ndims} dimensions, found {dims}")) + .with_error_code("E045") + .with_location(access.get_location()), + ) } } @@ -495,20 +537,28 @@ fn validate_array_access( if let Some(dimension) = dimensions.get(dimension_index) { if let Ok(range) = dimension.get_range(context.index) { if !(range.start as i128 <= *value && range.end as i128 >= *value) { - validator.push_diagnostic(Diagnostic::incompatible_array_access_range( - range, - access.get_location(), - )) + validator.push_diagnostic( + Diagnostic::error(format!( + "Array access must be in the range {}..{}", + range.start, range.end + )) + .with_error_code("E058") + .with_location(access.get_location()), + ) } } } } else { let type_info = context.annotations.get_type_or_void(access, context.index).get_type_information(); if !type_info.is_int() { - validator.push_diagnostic(Diagnostic::incompatible_array_access_type( - type_info.get_name(), - access.get_location(), - )) + validator.push_diagnostic( + Diagnostic::error(format!( + "Invalid type {} for array access. Only variables of Integer types are allowed to access an array", + type_info.get_name() + )) + .with_error_code("E059") + .with_location(access.get_location()) + ) } } } @@ -524,12 +574,16 @@ fn visit_binary_expression( match operator { Operator::Equal => { if context.annotations.get_type_hint(statement, context.index).is_none() { - let slice_lhs = validator.context.slice(&left.location); - let slice_rhs = validator.context.slice(&right.location); + let lhs = validator.context.slice(&left.location); + let rhs = validator.context.slice(&right.location); - validator.push_diagnostic(Diagnostic::assignment_instead_of_equal( - &slice_lhs, &slice_rhs, statement, - )); + validator.push_diagnostic( + Diagnostic::warning(format!( + "This equal statement has no effect, did you mean `{lhs} := {rhs}`?" + )) + .with_error_code("E023") + .with_location(statement.get_location()), + ); } validate_binary_expression(validator, statement, operator, left, right, context) @@ -574,13 +628,17 @@ fn validate_binary_expression( if operator.is_comparison_operator() && !compare_function_exists(left_type.get_name(), operator, context) { - validator.push_diagnostic(Diagnostic::missing_compare_function( - crate::typesystem::get_equals_function_name_for(left_type.get_name(), operator) - .unwrap_or_default() - .as_str(), - left_type.get_name(), - statement.get_location(), - )); + validator.push_diagnostic( + Diagnostic::error(format!( + "Missing compare function 'FUNCTION {} : BOOL VAR_INPUT a,b : {}; END_VAR ...'.", + crate::typesystem::get_equals_function_name_for(left_type.get_name(), operator) + .unwrap_or_default() + .as_str(), + left_type.get_name(), + )) + .with_error_code("E073") + .with_location(statement.get_location()), + ); } } } @@ -652,11 +710,15 @@ fn validate_call_by_ref(validator: &mut Validator, param: &VariableIndexEntry, a validate_call_by_ref(validator, param, &data.right); } - _ => validator.push_diagnostic(Diagnostic::invalid_argument_type( - param.get_name(), - ¶m.get_variable_type().to_string(), - arg.get_location(), - )), + _ => validator.push_diagnostic( + Diagnostic::error(format!( + "Expected a reference for parameter {} because their type is {}", + param.get_name(), + param.get_variable_type() + )) + .with_error_code("E031") + .with_location(arg.get_location()), + ), } } @@ -674,10 +736,11 @@ fn validate_assignment( { // ...constant variable if *constant { - validator.push_diagnostic(Diagnostic::cannot_assign_to_constant( - qualified_name.as_str(), - left.get_location(), - )); + validator.push_diagnostic( + Diagnostic::error(format!("Cannot assign to CONSTANT '{qualified_name}'")) + .with_error_code("E036") + .with_location(left.get_location()), + ); } else { // ...enum variable where the RHS does not match its variants validate_enum_variant_assignment( @@ -691,13 +754,22 @@ fn validate_assignment( // ...VAR_INPUT {ref} variable if matches!(argument_type, ArgumentType::ByRef(VariableType::Input)) { - validator.push_diagnostic(Diagnostic::var_input_ref_assignment(location.to_owned())); + validator.push_diagnostic( + Diagnostic::warning("VAR_INPUT {ref} variables are mutable and changes to them will also affect the referenced variable. For increased clarity use VAR_IN_OUT instead.") + .with_error_code("E042") + .with_location(location.to_owned()) + ); } } // ...or if whatever we got is not assignable, output an error if !left.can_be_assigned_to() { - validator.push_diagnostic(Diagnostic::reference_expected(left.get_location())); + let expression = validator.context.slice(&left.get_location()); + validator.push_diagnostic( + Diagnostic::error(format!("Expression {expression} is not assignable.")) + .with_error_code("E050") + .with_location(left.get_location()), + ); } } @@ -726,11 +798,23 @@ fn validate_assignment( if !(left_type.is_compatible_with_type(right_type) && is_valid_assignment(left_type, right_type, right, context.index, location, validator)) { - validator.push_diagnostic(Diagnostic::invalid_assignment( - &get_datatype_name_or_slice(validator.context, right_type), - &get_datatype_name_or_slice(validator.context, left_type), - location.clone(), - )); + if left_type.is_pointer() && right_type.is_pointer() { + validator.push_diagnostic( + Diagnostic::warning(format!( + "Pointers {} and {} have different types", + get_datatype_name_or_slice(validator.context, left_type), + get_datatype_name_or_slice(validator.context, right_type) + )) + .with_error_code("E090") + .with_location(location.clone()), + ); + } else { + validator.push_diagnostic(Diagnostic::invalid_assignment( + &get_datatype_name_or_slice(validator.context, right_type), + &get_datatype_name_or_slice(validator.context, left_type), + location.clone(), + )); + } } else if right.is_literal() { // TODO: See https://github.com/PLC-lang/rusty/issues/857 // validate_assignment_type_sizes(validator, left_type, right_type, location, context) @@ -746,7 +830,11 @@ pub(crate) fn validate_enum_variant_assignment( location: SourceLocation, ) { if left.is_enum() && left.get_name() != right.get_name() { - validator.push_diagnostic(Diagnostic::enum_variant_mismatch(qualified_name, location)) + validator.push_diagnostic( + Diagnostic::error(format!("Assigned value is not a variant of {qualified_name}")) + .with_error_code("E039") + .with_location(location), + ) } } @@ -818,10 +906,14 @@ fn is_valid_string_to_char_assignment( if value.len() == 1 { return true; } else { - validator.push_diagnostic(Diagnostic::syntax_error( - format!("Value: '{value}' exceeds length for type: {}", left_type.get_name()).as_str(), - location.clone(), - )); + validator.push_diagnostic( + Diagnostic::error( + format!("Value: '{value}' exceeds length for type: {}", left_type.get_name()) + .as_str(), + ) + .with_error_code("E065") + .with_location(location.clone()), + ); return false; } } @@ -844,12 +936,15 @@ fn is_invalid_pointer_assignment( && !left_type.is_pointer() && left_type.get_size_in_bits(index) < POINTER_SIZE { - validator.push_diagnostic(Diagnostic::incompatible_type_size( - left_type.get_name(), - left_type.get_size_in_bits(index), - "hold a", - location.clone(), - )); + validator.push_diagnostic( + Diagnostic::error(format!( + "The type {} {} is too small to hold a Pointer", + left_type.get_name(), + left_type.get_size_in_bits(index) + )) + .with_error_code("E065") + .with_location(location.clone()), + ); return true; } //check if size allocated to Pointer is standart pointer size (u64) @@ -857,12 +952,15 @@ fn is_invalid_pointer_assignment( && !right_type.is_pointer() && right_type.get_size_in_bits(index) < POINTER_SIZE { - validator.push_diagnostic(Diagnostic::incompatible_type_size( - right_type.get_name(), - right_type.get_size_in_bits(index), - "to be stored in a", - location.clone(), - )); + validator.push_diagnostic( + Diagnostic::error(format!( + "The type {} {} is too small to be stored in a Pointer", + right_type.get_name(), + right_type.get_size_in_bits(index) + )) + .with_error_code("E065") + .with_location(location.clone()), + ); return true; } false @@ -918,29 +1016,42 @@ fn validate_call( // validate parameters for (i, param) in passed_parameters.iter().enumerate() { - if let Ok((parameter_location_in_parent, right, is_implicit)) = - get_implicit_call_parameter(param, &declared_parameters, i) - { - let left = declared_parameters.get(parameter_location_in_parent); - if let Some(left) = left { - validate_call_by_ref(validator, left, param); - // 'parameter location in parent' and 'variable location in parent' are not the same (e.g VAR blocks are not counted as param). - // save actual location in parent for InOut validation - variable_location_in_parent.push(left.get_location_in_parent()); - } + match get_implicit_call_parameter(param, &declared_parameters, i) { + Ok((parameter_location_in_parent, right, is_implicit)) => { + let left = declared_parameters.get(parameter_location_in_parent); + if let Some(left) = left { + validate_call_by_ref(validator, left, param); + // 'parameter location in parent' and 'variable location in parent' are not the same (e.g VAR blocks are not counted as param). + // save actual location in parent for InOut validation + variable_location_in_parent.push(left.get_location_in_parent()); + } - // explicit call parameter assignments will be handled by - // `visit_statement()` via `Assignment` and `OutputAssignment` - if is_implicit { - validate_assignment(validator, right, None, ¶m.get_location(), context); - } + // explicit call parameter assignments will be handled by + // `visit_statement()` via `Assignment` and `OutputAssignment` + if is_implicit { + validate_assignment(validator, right, None, ¶m.get_location(), context); + } - // mixing implicit and explicit parameters is not allowed - // allways compare to the first passed parameter - if i == 0 { - are_implicit_parameters = is_implicit; - } else if are_implicit_parameters != is_implicit { - validator.push_diagnostic(Diagnostic::invalid_parameter_type(param.get_location())); + // mixing implicit and explicit parameters is not allowed + // allways compare to the first passed parameter + if i == 0 { + are_implicit_parameters = is_implicit; + } else if are_implicit_parameters != is_implicit { + validator.push_diagnostic( + Diagnostic::error("Cannot mix implicit and explicit call parameters!") + .with_error_code("E031") + .with_location(param.get_location()), + ); + } + } + Err(err) => { + validator.push_diagnostic( + Diagnostic::error("Invalid call parameters") + .with_error_code("E089") + .with_location(param.get_location()) + .with_sub_diagnostic(err), + ); + break; } } @@ -963,10 +1074,11 @@ fn validate_call( // check if all inouts were passed to the pou call declared_in_out_params.into_iter().for_each(|p| { if !variable_location_in_parent.contains(&p.get_location_in_parent()) { - validator.push_diagnostic(Diagnostic::missing_inout_parameter( - p.get_name(), - operator.get_location(), - )); + validator.push_diagnostic( + Diagnostic::error(format!("Missing inout parameter: {}", p.get_name())) + .with_error_code("E030") + .with_location(operator.get_location()), + ); } }); } @@ -1019,7 +1131,11 @@ fn validate_case_statement( // invalid case conditions if matches!(condition.get_stmt(), AstStatement::Assignment(_) | AstStatement::CallStatement(_)) { - validator.push_diagnostic(Diagnostic::invalid_case_condition(condition.get_location())); + validator.push_diagnostic( + Diagnostic::error("Invalid case condition!") + .with_error_code("E079") + .with_location(condition.get_location()), + ); } // validate for duplicate conditions @@ -1027,19 +1143,26 @@ fn validate_case_statement( const_evaluator::evaluate(condition, context.qualifier, context.index) .map_err(|err| { // value evaluation and validation not possible with non constants - validator.push_diagnostic(Diagnostic::non_constant_case_condition( - err.get_reason(), - condition.get_location(), - )) + validator.push_diagnostic( + Diagnostic::error(format!( + "{}. Non constant variables are not supported in case conditions", + err.get_reason() + )) + .with_error_code("E080") + .with_location(condition.get_location()), + ) }) .map(|v| { // check for duplicates if we got a value if let Some(AstNode { stmt: AstStatement::Literal(AstLiteral::Integer(value)), .. }) = v { if !cases.insert(value) { - validator.push_diagnostic(Diagnostic::duplicate_case_condition( - &value, - condition.get_location(), - )); + validator.push_diagnostic( + Diagnostic::error(format!( + "Duplicate condition value: {value}. Occurred more than once!" + )) + .with_error_code("E078") + .with_location(condition.get_location()), + ); } }; }) @@ -1066,11 +1189,11 @@ fn validate_type_nature( { if let DataTypeInformation::Generic { generic_symbol, nature, .. } = type_hint.get_type_information() { - validator.push_diagnostic(Diagnostic::unresolved_generic_type( - generic_symbol, - &format!("{nature:?}"), - statement.get_location(), - )) + validator.push_diagnostic( + Diagnostic::error(format!("Could not resolve generic type {generic_symbol} with {nature}")) + .with_error_code("E064") + .with_location(statement.get_location()), + ); } else if let Some((actual_type, generic_nature)) = context .annotations .get_type(statement, context.index) @@ -1082,11 +1205,15 @@ fn validate_type_nature( // INT parameter for REAL is allowed | (type_hint.is_real() & actual_type.is_numerical())) { - validator.push_diagnostic(Diagnostic::invalid_type_nature( - actual_type.get_name(), - format!("{generic_nature:?}").as_str(), - statement.get_location(), - )); + validator.push_diagnostic( + Diagnostic::error(format!( + "Invalid type nature for generic argument. {} is no {}", + actual_type.get_name(), + generic_nature + )) + .with_error_code("E062") + .with_location(statement.get_location()), + ); } } } @@ -1102,11 +1229,15 @@ fn _validate_assignment_type_sizes( if left.get_type_information().get_size(context.index) < right.get_type_information().get_size(context.index) { - validator.push_diagnostic(Diagnostic::implicit_downcast( - left.get_name(), - right.get_name(), - location.clone(), - )) + validator.push_diagnostic( + Diagnostic::info(format!( + "Potential loss of information due to assigning '{}' to variable of type '{}'.", + left.get_name(), + right.get_name() + )) + .with_error_code("E067") + .with_location(location.clone()), + ) } } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__pointer_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__pointer_assignment_validation.snap index b6fe039abc..b6fdcb242b 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__pointer_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__pointer_assignment_validation.snap @@ -26,17 +26,17 @@ error: Invalid assignment: cannot assign 'REF_TO INT' to 'WORD' 29 │ v_word := v_ptr_int; // INVALID │ ^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign 'REF_TO INT' to 'WORD' -error: Invalid assignment: cannot assign '__POINTER_TO_REAL' to 'REF_TO INT' +warning: Pointers REF_TO INT and __POINTER_TO_REAL have different types ┌─ :31:5 │ 31 │ v_ptr_int := &v_real; // INVALID -> TODO: should be valid - │ ^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_REAL' to 'REF_TO INT' + │ ^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO INT and __POINTER_TO_REAL have different types -error: Invalid assignment: cannot assign '__POINTER_TO_STRING' to 'REF_TO INT' +warning: Pointers REF_TO INT and __POINTER_TO_STRING have different types ┌─ :41:5 │ 41 │ v_ptr_int := &v_string; // INVALID - │ ^^^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_STRING' to 'REF_TO INT' + │ ^^^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO INT and __POINTER_TO_STRING have different types error: Invalid assignment: cannot assign 'STRING' to 'INT' ┌─ :42:5 diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__struct_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__struct_assignment_validation.snap index 25d46b29bf..f46282b749 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__struct_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__struct_assignment_validation.snap @@ -32,40 +32,40 @@ error: Invalid assignment: cannot assign 'STRUCT2' to 'STRUCT1' 56 │ myFB(var_inout_struct1 := v_struct2); // INVALID │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign 'STRUCT2' to 'STRUCT1' -error: Invalid assignment: cannot assign '__POINTER_TO_REAL' to 'REF_TO STRUCT1' +warning: Pointers REF_TO STRUCT1 and __POINTER_TO_REAL have different types ┌─ :67:5 │ 67 │ v_ref_to_struct1 := REF(v_real); // INVALID - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_REAL' to 'REF_TO STRUCT1' + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT1 and __POINTER_TO_REAL have different types -error: Invalid assignment: cannot assign '__POINTER_TO_STRING' to 'REF_TO STRUCT1' +warning: Pointers REF_TO STRUCT1 and __POINTER_TO_STRING have different types ┌─ :68:5 │ 68 │ v_ref_to_struct1 := REF(v_string); // INVALID - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_STRING' to 'REF_TO STRUCT1' + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT1 and __POINTER_TO_STRING have different types -error: Invalid assignment: cannot assign '__POINTER_TO_CHAR' to 'REF_TO STRUCT1' +warning: Pointers REF_TO STRUCT1 and __POINTER_TO_CHAR have different types ┌─ :69:5 │ 69 │ v_ref_to_struct1 := REF(v_char); // INVALID - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_CHAR' to 'REF_TO STRUCT1' + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT1 and __POINTER_TO_CHAR have different types -error: Invalid assignment: cannot assign '__POINTER_TO_REAL' to 'REF_TO STRUCT1' +warning: Pointers REF_TO STRUCT1 and __POINTER_TO_REAL have different types ┌─ :71:5 │ 71 │ v_ref_to_struct1 := &(v_real); // INVALID - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_REAL' to 'REF_TO STRUCT1' + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT1 and __POINTER_TO_REAL have different types -error: Invalid assignment: cannot assign '__POINTER_TO_STRING' to 'REF_TO STRUCT1' +warning: Pointers REF_TO STRUCT1 and __POINTER_TO_STRING have different types ┌─ :72:5 │ 72 │ v_ref_to_struct1 := &(v_string); // INVALID - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_STRING' to 'REF_TO STRUCT1' + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT1 and __POINTER_TO_STRING have different types -error: Invalid assignment: cannot assign '__POINTER_TO_CHAR' to 'REF_TO STRUCT1' +warning: Pointers REF_TO STRUCT1 and __POINTER_TO_CHAR have different types ┌─ :73:5 │ 73 │ v_ref_to_struct1 := &(v_char); // INVALID - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_CHAR' to 'REF_TO STRUCT1' + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT1 and __POINTER_TO_CHAR have different types diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_range_test.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_range_test.snap index 804d1979eb..00ab78f17f 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_range_test.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_range_test.snap @@ -2,28 +2,28 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: "&diagnostics" --- -error: Bit-Wise access for type BYTE must be in the range 0..7 +error: Bit-Wise access for type BYTE must be in range 0..7 ┌─ :6:19 │ 6 │ a.8; - │ ^ Bit-Wise access for type BYTE must be in the range 0..7 + │ ^ Bit-Wise access for type BYTE must be in range 0..7 -error: Bit-Wise access for type WORD must be in the range 0..15 +error: Bit-Wise access for type WORD must be in range 0..15 ┌─ :7:19 │ 7 │ b.16; - │ ^^ Bit-Wise access for type WORD must be in the range 0..15 + │ ^^ Bit-Wise access for type WORD must be in range 0..15 -error: Bit-Wise access for type DWORD must be in the range 0..31 +error: Bit-Wise access for type DWORD must be in range 0..31 ┌─ :8:19 │ 8 │ c.32; - │ ^^ Bit-Wise access for type DWORD must be in the range 0..31 + │ ^^ Bit-Wise access for type DWORD must be in range 0..31 -error: Bit-Wise access for type LWORD must be in the range 0..63 +error: Bit-Wise access for type LWORD must be in range 0..63 ┌─ :9:19 │ 9 │ d.64; - │ ^^ Bit-Wise access for type LWORD must be in the range 0..63 + │ ^^ Bit-Wise access for type LWORD must be in range 0..63 diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_range_test.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_range_test.snap index fbdbcc2eb1..29640d9f7d 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_range_test.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_range_test.snap @@ -2,22 +2,22 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: "&diagnostics" --- -error: Byte-Wise access for type WORD must be in the range 0..1 +error: Byte-Wise access for type WORD must be in range 0..1 ┌─ :6:19 │ 6 │ b.%B2; - │ ^^^ Byte-Wise access for type WORD must be in the range 0..1 + │ ^^^ Byte-Wise access for type WORD must be in range 0..1 -error: Byte-Wise access for type DWORD must be in the range 0..3 +error: Byte-Wise access for type DWORD must be in range 0..3 ┌─ :7:19 │ 7 │ c.%B4; - │ ^^^ Byte-Wise access for type DWORD must be in the range 0..3 + │ ^^^ Byte-Wise access for type DWORD must be in range 0..3 -error: Byte-Wise access for type LWORD must be in the range 0..7 +error: Byte-Wise access for type LWORD must be in range 0..7 ┌─ :8:19 │ 8 │ d.%B8; - │ ^^^ Byte-Wise access for type LWORD must be in the range 0..7 + │ ^^^ Byte-Wise access for type LWORD must be in range 0..7 diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_range_test.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_range_test.snap index 7cb499e1b8..a36bc9d38f 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_range_test.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_range_test.snap @@ -2,10 +2,10 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: "&diagnostics" --- -error: DWord-Wise access for type LWORD must be in the range 0..1 +error: DWord-Wise access for type LWORD must be in range 0..1 ┌─ :6:19 │ 6 │ d.%D2; - │ ^^^ DWord-Wise access for type LWORD must be in the range 0..1 + │ ^^^ DWord-Wise access for type LWORD must be in range 0..1 diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_range_test.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_range_test.snap index 2a33cc4578..34693ff841 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_range_test.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_range_test.snap @@ -2,16 +2,16 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: "&diagnostics" --- -error: Word-Wise access for type DWORD must be in the range 0..1 +error: Word-Wise access for type DWORD must be in range 0..1 ┌─ :6:19 │ 6 │ c.%W2; - │ ^^^ Word-Wise access for type DWORD must be in the range 0..1 + │ ^^^ Word-Wise access for type DWORD must be in range 0..1 -error: Word-Wise access for type LWORD must be in the range 0..3 +error: Word-Wise access for type LWORD must be in range 0..3 ┌─ :7:19 │ 7 │ d.%W4; - │ ^^^ Word-Wise access for type LWORD must be in the range 0..3 + │ ^^^ Word-Wise access for type LWORD must be in range 0..3 diff --git a/src/validation/tests/snapshots/rusty__validation__tests__builtin_validation_tests__arithmetic_builtins_called_with_invalid_param_count.snap b/src/validation/tests/snapshots/rusty__validation__tests__builtin_validation_tests__arithmetic_builtins_called_with_invalid_param_count.snap index 98b76750af..b931e3f89b 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__builtin_validation_tests__arithmetic_builtins_called_with_invalid_param_count.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__builtin_validation_tests__arithmetic_builtins_called_with_invalid_param_count.snap @@ -8,11 +8,11 @@ error: Invalid parameter count. Received 0 parameters while 2 parameters were ex 7 │ ADD(); │ ^^^ Invalid parameter count. Received 0 parameters while 2 parameters were expected. -error: Could not resolve generic type T with nature Num +error: Could not resolve generic type T with ANY_NUMBER ┌─ :7:13 │ 7 │ ADD(); - │ ^^^^^^ Could not resolve generic type T with nature Num + │ ^^^^^^ Could not resolve generic type T with ANY_NUMBER error: Invalid parameter count. Received 1 parameters while 2 parameters were expected. ┌─ :8:13 diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_chars.snap index 020ab54286..37369341b0 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_chars.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'CHAR' to 'BOOL' 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'CHAR' to 'BOOL' -error: Invalid type nature for generic argument. CHAR is no Bit. +error: Invalid type nature for generic argument. CHAR is no ANY_BIT ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. CHAR is no Bit. + │ ^ Invalid type nature for generic argument. CHAR is no ANY_BIT error: Invalid assignment: cannot assign 'WCHAR' to 'BOOL' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WCHAR' to 'BOOL' 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WCHAR' to 'BOOL' -error: Invalid type nature for generic argument. WCHAR is no Bit. +error: Invalid type nature for generic argument. WCHAR is no ANY_BIT ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WCHAR is no Bit. + │ ^ Invalid type nature for generic argument. WCHAR is no ANY_BIT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_date.snap index 7227a62e07..4abafae68a 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_date.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. DATE_AND_TIME is no Bit. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_BIT ┌─ :3:56 │ 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Bit. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_BIT -error: Invalid type nature for generic argument. DATE_AND_TIME is no Bit. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_BIT ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Bit. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_BIT -error: Invalid type nature for generic argument. DATE is no Bit. +error: Invalid type nature for generic argument. DATE is no ANY_BIT ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE is no Bit. + │ ^ Invalid type nature for generic argument. DATE is no ANY_BIT -error: Invalid type nature for generic argument. TIME_OF_DAY is no Bit. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_BIT ┌─ :6:57 │ 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Bit. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_BIT -error: Invalid type nature for generic argument. TIME_OF_DAY is no Bit. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_BIT ┌─ :7:58 │ 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Bit. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_BIT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_ints.snap index 8341e11c46..77f700d06c 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_ints.snap @@ -2,52 +2,52 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. USINT is no Bit. +error: Invalid type nature for generic argument. USINT is no ANY_BIT ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. USINT is no Bit. + │ ^ Invalid type nature for generic argument. USINT is no ANY_BIT -error: Invalid type nature for generic argument. UINT is no Bit. +error: Invalid type nature for generic argument. UINT is no ANY_BIT ┌─ :5:58 │ 5 │ FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UINT is no Bit. + │ ^ Invalid type nature for generic argument. UINT is no ANY_BIT -error: Invalid type nature for generic argument. UDINT is no Bit. +error: Invalid type nature for generic argument. UDINT is no ANY_BIT ┌─ :6:59 │ 6 │ FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UDINT is no Bit. + │ ^ Invalid type nature for generic argument. UDINT is no ANY_BIT -error: Invalid type nature for generic argument. ULINT is no Bit. +error: Invalid type nature for generic argument. ULINT is no ANY_BIT ┌─ :7:59 │ 7 │ FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. ULINT is no Bit. + │ ^ Invalid type nature for generic argument. ULINT is no ANY_BIT -error: Invalid type nature for generic argument. SINT is no Bit. +error: Invalid type nature for generic argument. SINT is no ANY_BIT ┌─ :9:58 │ 9 │ FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. SINT is no Bit. + │ ^ Invalid type nature for generic argument. SINT is no ANY_BIT -error: Invalid type nature for generic argument. INT is no Bit. +error: Invalid type nature for generic argument. INT is no ANY_BIT ┌─ :10:57 │ 10 │ FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. INT is no Bit. + │ ^ Invalid type nature for generic argument. INT is no ANY_BIT -error: Invalid type nature for generic argument. DINT is no Bit. +error: Invalid type nature for generic argument. DINT is no ANY_BIT ┌─ :11:58 │ 11 │ FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DINT is no Bit. + │ ^ Invalid type nature for generic argument. DINT is no ANY_BIT -error: Invalid type nature for generic argument. LINT is no Bit. +error: Invalid type nature for generic argument. LINT is no ANY_BIT ┌─ :12:58 │ 12 │ FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LINT is no Bit. + │ ^ Invalid type nature for generic argument. LINT is no ANY_BIT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_reals.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_reals.snap index 4071b5e73e..c8283fc9e5 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_reals.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_reals.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Bit. +error: Invalid type nature for generic argument. REAL is no ANY_BIT ┌─ :3:57 │ 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. REAL is no Bit. + │ ^ Invalid type nature for generic argument. REAL is no ANY_BIT -error: Invalid type nature for generic argument. LREAL is no Bit. +error: Invalid type nature for generic argument. LREAL is no ANY_BIT ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LREAL is no Bit. + │ ^ Invalid type nature for generic argument. LREAL is no ANY_BIT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_string.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_string.snap index dbb485e496..310d83affc 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_string.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_string.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'BOOL' 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'STRING' to 'BOOL' -error: Invalid type nature for generic argument. STRING is no Bit. +error: Invalid type nature for generic argument. STRING is no ANY_BIT ┌─ :3:61 │ 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. STRING is no Bit. + │ ^ Invalid type nature for generic argument. STRING is no ANY_BIT error: Invalid assignment: cannot assign 'WSTRING' to 'BOOL' ┌─ :4:61 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WSTRING' to 'BOOL' 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WSTRING' to 'BOOL' -error: Invalid type nature for generic argument. WSTRING is no Bit. +error: Invalid type nature for generic argument. WSTRING is no ANY_BIT ┌─ :4:61 │ 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WSTRING is no Bit. + │ ^ Invalid type nature for generic argument. WSTRING is no ANY_BIT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_time.snap index 24689e2db5..e425d19237 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_time.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. TIME is no Bit. +error: Invalid type nature for generic argument. TIME is no ANY_BIT ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Bit. + │ ^ Invalid type nature for generic argument. TIME is no ANY_BIT -error: Invalid type nature for generic argument. TIME is no Bit. +error: Invalid type nature for generic argument. TIME is no ANY_BIT ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Bit. + │ ^ Invalid type nature for generic argument. TIME is no ANY_BIT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_multiple_parameters.snap index 11905946ad..95e66bd499 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_multiple_parameters.snap @@ -2,29 +2,29 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Bit. +error: Invalid type nature for generic argument. REAL is no ANY_BIT ┌─ :15:14 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no Bit. + │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no ANY_BIT -error: Invalid type nature for generic argument. UDINT is no Bit. +error: Invalid type nature for generic argument. UDINT is no ANY_BIT ┌─ :15:24 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no Bit. + │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no ANY_BIT -error: Invalid type nature for generic argument. DINT is no Bit. +error: Invalid type nature for generic argument. DINT is no ANY_BIT ┌─ :15:38 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no Bit. + │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no ANY_BIT -error: Invalid type nature for generic argument. TIME is no Bit. +error: Invalid type nature for generic argument. TIME is no ANY_BIT ┌─ :15:50 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no Bit. + │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_BIT error: Invalid assignment: cannot assign 'STRING' to 'BYTE' ┌─ :15:70 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'BYTE' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^ Invalid assignment: cannot assign 'STRING' to 'BYTE' -error: Invalid type nature for generic argument. STRING is no Bit. +error: Invalid type nature for generic argument. STRING is no ANY_BIT ┌─ :15:70 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^ Invalid type nature for generic argument. STRING is no Bit. + │ ^^^^^^^ Invalid type nature for generic argument. STRING is no ANY_BIT error: Invalid assignment: cannot assign 'CHAR' to 'BYTE' ┌─ :15:79 @@ -44,16 +44,16 @@ error: Invalid assignment: cannot assign 'CHAR' to 'BYTE' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'CHAR' to 'BYTE' -error: Invalid type nature for generic argument. CHAR is no Bit. +error: Invalid type nature for generic argument. CHAR is no ANY_BIT ┌─ :15:79 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no Bit. + │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no ANY_BIT -error: Invalid type nature for generic argument. DATE is no Bit. +error: Invalid type nature for generic argument. DATE is no ANY_BIT ┌─ :15:89 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no Bit. + │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no ANY_BIT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_bits.snap index b17146fe1e..9902712c73 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_bits.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'BOOL' to 'CHAR' 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'BOOL' to 'CHAR' -error: Invalid type nature for generic argument. BOOL is no Char. +error: Invalid type nature for generic argument. BOOL is no ANY_CHAR ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BOOL is no Char. + │ ^ Invalid type nature for generic argument. BOOL is no ANY_CHAR error: Invalid assignment: cannot assign 'BYTE' to 'CHAR' ┌─ :4:58 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'BYTE' to 'CHAR' 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'BYTE' to 'CHAR' -error: Invalid type nature for generic argument. BYTE is no Char. +error: Invalid type nature for generic argument. BYTE is no ANY_CHAR ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BYTE is no Char. + │ ^ Invalid type nature for generic argument. BYTE is no ANY_CHAR error: Invalid assignment: cannot assign 'WORD' to 'CHAR' ┌─ :5:58 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'WORD' to 'CHAR' 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WORD' to 'CHAR' -error: Invalid type nature for generic argument. WORD is no Char. +error: Invalid type nature for generic argument. WORD is no ANY_CHAR ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WORD is no Char. + │ ^ Invalid type nature for generic argument. WORD is no ANY_CHAR error: Invalid assignment: cannot assign 'DWORD' to 'CHAR' ┌─ :6:59 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'DWORD' to 'CHAR' 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DWORD' to 'CHAR' -error: Invalid type nature for generic argument. DWORD is no Char. +error: Invalid type nature for generic argument. DWORD is no ANY_CHAR ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DWORD is no Char. + │ ^ Invalid type nature for generic argument. DWORD is no ANY_CHAR error: Invalid assignment: cannot assign 'LWORD' to 'CHAR' ┌─ :7:59 @@ -56,10 +56,10 @@ error: Invalid assignment: cannot assign 'LWORD' to 'CHAR' 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'LWORD' to 'CHAR' -error: Invalid type nature for generic argument. LWORD is no Char. +error: Invalid type nature for generic argument. LWORD is no ANY_CHAR ┌─ :7:59 │ 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LWORD is no Char. + │ ^ Invalid type nature for generic argument. LWORD is no ANY_CHAR diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_date.snap index 2dcbc188eb..34cbc0030c 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_date.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR' 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR' -error: Invalid type nature for generic argument. DATE_AND_TIME is no Char. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_CHAR ┌─ :3:56 │ 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Char. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_CHAR error: Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR' ┌─ :4:57 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR' 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR' -error: Invalid type nature for generic argument. DATE_AND_TIME is no Char. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_CHAR ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Char. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_CHAR error: Invalid assignment: cannot assign 'DATE' to 'CHAR' ┌─ :5:58 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'DATE' to 'CHAR' 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DATE' to 'CHAR' -error: Invalid type nature for generic argument. DATE is no Char. +error: Invalid type nature for generic argument. DATE is no ANY_CHAR ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE is no Char. + │ ^ Invalid type nature for generic argument. DATE is no ANY_CHAR error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' ┌─ :6:57 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' -error: Invalid type nature for generic argument. TIME_OF_DAY is no Char. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_CHAR ┌─ :6:57 │ 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Char. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_CHAR error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' ┌─ :7:58 @@ -56,10 +56,10 @@ error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' -error: Invalid type nature for generic argument. TIME_OF_DAY is no Char. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_CHAR ┌─ :7:58 │ 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Char. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_CHAR diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_ints.snap index ef1540f3e9..26731f36e8 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_ints.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'USINT' to 'CHAR' 4 │ FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'USINT' to 'CHAR' -error: Invalid type nature for generic argument. USINT is no Char. +error: Invalid type nature for generic argument. USINT is no ANY_CHAR ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. USINT is no Char. + │ ^ Invalid type nature for generic argument. USINT is no ANY_CHAR error: Invalid assignment: cannot assign 'UINT' to 'CHAR' ┌─ :5:58 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'UINT' to 'CHAR' 5 │ FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'UINT' to 'CHAR' -error: Invalid type nature for generic argument. UINT is no Char. +error: Invalid type nature for generic argument. UINT is no ANY_CHAR ┌─ :5:58 │ 5 │ FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UINT is no Char. + │ ^ Invalid type nature for generic argument. UINT is no ANY_CHAR error: Invalid assignment: cannot assign 'UDINT' to 'CHAR' ┌─ :6:59 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'UDINT' to 'CHAR' 6 │ FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'UDINT' to 'CHAR' -error: Invalid type nature for generic argument. UDINT is no Char. +error: Invalid type nature for generic argument. UDINT is no ANY_CHAR ┌─ :6:59 │ 6 │ FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UDINT is no Char. + │ ^ Invalid type nature for generic argument. UDINT is no ANY_CHAR error: Invalid assignment: cannot assign 'ULINT' to 'CHAR' ┌─ :7:59 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'ULINT' to 'CHAR' 7 │ FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'ULINT' to 'CHAR' -error: Invalid type nature for generic argument. ULINT is no Char. +error: Invalid type nature for generic argument. ULINT is no ANY_CHAR ┌─ :7:59 │ 7 │ FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. ULINT is no Char. + │ ^ Invalid type nature for generic argument. ULINT is no ANY_CHAR error: Invalid assignment: cannot assign 'SINT' to 'CHAR' ┌─ :9:58 @@ -56,11 +56,11 @@ error: Invalid assignment: cannot assign 'SINT' to 'CHAR' 9 │ FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'SINT' to 'CHAR' -error: Invalid type nature for generic argument. SINT is no Char. +error: Invalid type nature for generic argument. SINT is no ANY_CHAR ┌─ :9:58 │ 9 │ FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. SINT is no Char. + │ ^ Invalid type nature for generic argument. SINT is no ANY_CHAR error: Invalid assignment: cannot assign 'INT' to 'CHAR' ┌─ :10:57 @@ -68,11 +68,11 @@ error: Invalid assignment: cannot assign 'INT' to 'CHAR' 10 │ FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'INT' to 'CHAR' -error: Invalid type nature for generic argument. INT is no Char. +error: Invalid type nature for generic argument. INT is no ANY_CHAR ┌─ :10:57 │ 10 │ FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. INT is no Char. + │ ^ Invalid type nature for generic argument. INT is no ANY_CHAR error: Invalid assignment: cannot assign 'DINT' to 'CHAR' ┌─ :11:58 @@ -80,11 +80,11 @@ error: Invalid assignment: cannot assign 'DINT' to 'CHAR' 11 │ FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DINT' to 'CHAR' -error: Invalid type nature for generic argument. DINT is no Char. +error: Invalid type nature for generic argument. DINT is no ANY_CHAR ┌─ :11:58 │ 11 │ FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DINT is no Char. + │ ^ Invalid type nature for generic argument. DINT is no ANY_CHAR error: Invalid assignment: cannot assign 'LINT' to 'CHAR' ┌─ :12:58 @@ -92,10 +92,10 @@ error: Invalid assignment: cannot assign 'LINT' to 'CHAR' 12 │ FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'LINT' to 'CHAR' -error: Invalid type nature for generic argument. LINT is no Char. +error: Invalid type nature for generic argument. LINT is no ANY_CHAR ┌─ :12:58 │ 12 │ FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LINT is no Char. + │ ^ Invalid type nature for generic argument. LINT is no ANY_CHAR diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_reals.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_reals.snap index 9603ae431e..13574c1e0d 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_reals.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_reals.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'REAL' to 'CHAR' 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'REAL' to 'CHAR' -error: Invalid type nature for generic argument. REAL is no Char. +error: Invalid type nature for generic argument. REAL is no ANY_CHAR ┌─ :3:57 │ 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. REAL is no Char. + │ ^ Invalid type nature for generic argument. REAL is no ANY_CHAR error: Invalid assignment: cannot assign 'LREAL' to 'CHAR' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'LREAL' to 'CHAR' 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'LREAL' to 'CHAR' -error: Invalid type nature for generic argument. LREAL is no Char. +error: Invalid type nature for generic argument. LREAL is no ANY_CHAR ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LREAL is no Char. + │ ^ Invalid type nature for generic argument. LREAL is no ANY_CHAR diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_string.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_string.snap index 735004186f..f150ce2525 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_string.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_string.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'CHAR' 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'STRING' to 'CHAR' -error: Invalid type nature for generic argument. STRING is no Char. +error: Invalid type nature for generic argument. STRING is no ANY_CHAR ┌─ :3:61 │ 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. STRING is no Char. + │ ^ Invalid type nature for generic argument. STRING is no ANY_CHAR error: Invalid assignment: cannot assign 'WSTRING' to 'CHAR' ┌─ :4:61 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WSTRING' to 'CHAR' 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WSTRING' to 'CHAR' -error: Invalid type nature for generic argument. WSTRING is no Char. +error: Invalid type nature for generic argument. WSTRING is no ANY_CHAR ┌─ :4:61 │ 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WSTRING is no Char. + │ ^ Invalid type nature for generic argument. WSTRING is no ANY_CHAR diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_time.snap index 9b128886f5..9dcbb0b99a 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_time.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'TIME' to 'CHAR' 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME' to 'CHAR' -error: Invalid type nature for generic argument. TIME is no Char. +error: Invalid type nature for generic argument. TIME is no ANY_CHAR ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Char. + │ ^ Invalid type nature for generic argument. TIME is no ANY_CHAR error: Invalid assignment: cannot assign 'TIME' to 'CHAR' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'TIME' to 'CHAR' 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME' to 'CHAR' -error: Invalid type nature for generic argument. TIME is no Char. +error: Invalid type nature for generic argument. TIME is no ANY_CHAR ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Char. + │ ^ Invalid type nature for generic argument. TIME is no ANY_CHAR diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_multiple_parameters.snap index 69d138b214..414b917691 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_multiple_parameters.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'REAL' to 'CHAR' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'REAL' to 'CHAR' -error: Invalid type nature for generic argument. REAL is no Char. +error: Invalid type nature for generic argument. REAL is no ANY_CHAR ┌─ :15:14 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no Char. + │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no ANY_CHAR error: Invalid assignment: cannot assign 'UDINT' to 'CHAR' ┌─ :15:24 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'UDINT' to 'CHAR' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^^^^^ Invalid assignment: cannot assign 'UDINT' to 'CHAR' -error: Invalid type nature for generic argument. UDINT is no Char. +error: Invalid type nature for generic argument. UDINT is no ANY_CHAR ┌─ :15:24 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no Char. + │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no ANY_CHAR error: Invalid assignment: cannot assign 'DINT' to 'CHAR' ┌─ :15:38 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'DINT' to 'CHAR' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^^^ Invalid assignment: cannot assign 'DINT' to 'CHAR' -error: Invalid type nature for generic argument. DINT is no Char. +error: Invalid type nature for generic argument. DINT is no ANY_CHAR ┌─ :15:38 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no Char. + │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no ANY_CHAR error: Invalid assignment: cannot assign 'TIME' to 'CHAR' ┌─ :15:50 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'TIME' to 'CHAR' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'TIME' to 'CHAR' -error: Invalid type nature for generic argument. TIME is no Char. +error: Invalid type nature for generic argument. TIME is no ANY_CHAR ┌─ :15:50 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no Char. + │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_CHAR error: Invalid assignment: cannot assign 'BYTE' to 'CHAR' ┌─ :15:60 @@ -56,11 +56,11 @@ error: Invalid assignment: cannot assign 'BYTE' to 'CHAR' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'BYTE' to 'CHAR' -error: Invalid type nature for generic argument. BYTE is no Char. +error: Invalid type nature for generic argument. BYTE is no ANY_CHAR ┌─ :15:60 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no Char. + │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no ANY_CHAR error: Invalid assignment: cannot assign 'STRING' to 'CHAR' ┌─ :15:70 @@ -68,11 +68,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'CHAR' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^ Invalid assignment: cannot assign 'STRING' to 'CHAR' -error: Invalid type nature for generic argument. STRING is no Char. +error: Invalid type nature for generic argument. STRING is no ANY_CHAR ┌─ :15:70 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^ Invalid type nature for generic argument. STRING is no Char. + │ ^^^^^^^ Invalid type nature for generic argument. STRING is no ANY_CHAR error: Invalid assignment: cannot assign 'DATE' to 'CHAR' ┌─ :15:89 @@ -80,10 +80,10 @@ error: Invalid assignment: cannot assign 'DATE' to 'CHAR' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'DATE' to 'CHAR' -error: Invalid type nature for generic argument. DATE is no Char. +error: Invalid type nature for generic argument. DATE is no ANY_CHAR ┌─ :15:89 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no Char. + │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no ANY_CHAR diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_bits.snap index 09e0e945b5..b1821a4106 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_bits.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'BOOL' to 'CHAR' 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'BOOL' to 'CHAR' -error: Invalid type nature for generic argument. BOOL is no Chars. +error: Invalid type nature for generic argument. BOOL is no ANY_CHARS ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BOOL is no Chars. + │ ^ Invalid type nature for generic argument. BOOL is no ANY_CHARS error: Invalid assignment: cannot assign 'BYTE' to 'CHAR' ┌─ :4:58 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'BYTE' to 'CHAR' 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'BYTE' to 'CHAR' -error: Invalid type nature for generic argument. BYTE is no Chars. +error: Invalid type nature for generic argument. BYTE is no ANY_CHARS ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BYTE is no Chars. + │ ^ Invalid type nature for generic argument. BYTE is no ANY_CHARS error: Invalid assignment: cannot assign 'WORD' to 'CHAR' ┌─ :5:58 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'WORD' to 'CHAR' 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WORD' to 'CHAR' -error: Invalid type nature for generic argument. WORD is no Chars. +error: Invalid type nature for generic argument. WORD is no ANY_CHARS ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WORD is no Chars. + │ ^ Invalid type nature for generic argument. WORD is no ANY_CHARS error: Invalid assignment: cannot assign 'DWORD' to 'CHAR' ┌─ :6:59 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'DWORD' to 'CHAR' 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DWORD' to 'CHAR' -error: Invalid type nature for generic argument. DWORD is no Chars. +error: Invalid type nature for generic argument. DWORD is no ANY_CHARS ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DWORD is no Chars. + │ ^ Invalid type nature for generic argument. DWORD is no ANY_CHARS error: Invalid assignment: cannot assign 'LWORD' to 'CHAR' ┌─ :7:59 @@ -56,10 +56,10 @@ error: Invalid assignment: cannot assign 'LWORD' to 'CHAR' 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'LWORD' to 'CHAR' -error: Invalid type nature for generic argument. LWORD is no Chars. +error: Invalid type nature for generic argument. LWORD is no ANY_CHARS ┌─ :7:59 │ 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LWORD is no Chars. + │ ^ Invalid type nature for generic argument. LWORD is no ANY_CHARS diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_date.snap index da583782fd..9f8effc46a 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_date.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR' 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR' -error: Invalid type nature for generic argument. DATE_AND_TIME is no Chars. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_CHARS ┌─ :3:56 │ 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Chars. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_CHARS error: Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR' ┌─ :4:57 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR' 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR' -error: Invalid type nature for generic argument. DATE_AND_TIME is no Chars. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_CHARS ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Chars. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_CHARS error: Invalid assignment: cannot assign 'DATE' to 'CHAR' ┌─ :5:58 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'DATE' to 'CHAR' 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DATE' to 'CHAR' -error: Invalid type nature for generic argument. DATE is no Chars. +error: Invalid type nature for generic argument. DATE is no ANY_CHARS ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE is no Chars. + │ ^ Invalid type nature for generic argument. DATE is no ANY_CHARS error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' ┌─ :6:57 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' -error: Invalid type nature for generic argument. TIME_OF_DAY is no Chars. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_CHARS ┌─ :6:57 │ 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Chars. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_CHARS error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' ┌─ :7:58 @@ -56,10 +56,10 @@ error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR' -error: Invalid type nature for generic argument. TIME_OF_DAY is no Chars. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_CHARS ┌─ :7:58 │ 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Chars. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_CHARS diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_ints.snap index 5b220a10a7..5adf0b6123 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_ints.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'USINT' to 'CHAR' 4 │ FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'USINT' to 'CHAR' -error: Invalid type nature for generic argument. USINT is no Chars. +error: Invalid type nature for generic argument. USINT is no ANY_CHARS ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. USINT is no Chars. + │ ^ Invalid type nature for generic argument. USINT is no ANY_CHARS error: Invalid assignment: cannot assign 'UINT' to 'CHAR' ┌─ :5:58 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'UINT' to 'CHAR' 5 │ FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'UINT' to 'CHAR' -error: Invalid type nature for generic argument. UINT is no Chars. +error: Invalid type nature for generic argument. UINT is no ANY_CHARS ┌─ :5:58 │ 5 │ FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UINT is no Chars. + │ ^ Invalid type nature for generic argument. UINT is no ANY_CHARS error: Invalid assignment: cannot assign 'UDINT' to 'CHAR' ┌─ :6:59 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'UDINT' to 'CHAR' 6 │ FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'UDINT' to 'CHAR' -error: Invalid type nature for generic argument. UDINT is no Chars. +error: Invalid type nature for generic argument. UDINT is no ANY_CHARS ┌─ :6:59 │ 6 │ FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UDINT is no Chars. + │ ^ Invalid type nature for generic argument. UDINT is no ANY_CHARS error: Invalid assignment: cannot assign 'ULINT' to 'CHAR' ┌─ :7:59 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'ULINT' to 'CHAR' 7 │ FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'ULINT' to 'CHAR' -error: Invalid type nature for generic argument. ULINT is no Chars. +error: Invalid type nature for generic argument. ULINT is no ANY_CHARS ┌─ :7:59 │ 7 │ FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. ULINT is no Chars. + │ ^ Invalid type nature for generic argument. ULINT is no ANY_CHARS error: Invalid assignment: cannot assign 'SINT' to 'CHAR' ┌─ :9:58 @@ -56,11 +56,11 @@ error: Invalid assignment: cannot assign 'SINT' to 'CHAR' 9 │ FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'SINT' to 'CHAR' -error: Invalid type nature for generic argument. SINT is no Chars. +error: Invalid type nature for generic argument. SINT is no ANY_CHARS ┌─ :9:58 │ 9 │ FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. SINT is no Chars. + │ ^ Invalid type nature for generic argument. SINT is no ANY_CHARS error: Invalid assignment: cannot assign 'INT' to 'CHAR' ┌─ :10:57 @@ -68,11 +68,11 @@ error: Invalid assignment: cannot assign 'INT' to 'CHAR' 10 │ FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'INT' to 'CHAR' -error: Invalid type nature for generic argument. INT is no Chars. +error: Invalid type nature for generic argument. INT is no ANY_CHARS ┌─ :10:57 │ 10 │ FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. INT is no Chars. + │ ^ Invalid type nature for generic argument. INT is no ANY_CHARS error: Invalid assignment: cannot assign 'DINT' to 'CHAR' ┌─ :11:58 @@ -80,11 +80,11 @@ error: Invalid assignment: cannot assign 'DINT' to 'CHAR' 11 │ FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DINT' to 'CHAR' -error: Invalid type nature for generic argument. DINT is no Chars. +error: Invalid type nature for generic argument. DINT is no ANY_CHARS ┌─ :11:58 │ 11 │ FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DINT is no Chars. + │ ^ Invalid type nature for generic argument. DINT is no ANY_CHARS error: Invalid assignment: cannot assign 'LINT' to 'CHAR' ┌─ :12:58 @@ -92,10 +92,10 @@ error: Invalid assignment: cannot assign 'LINT' to 'CHAR' 12 │ FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'LINT' to 'CHAR' -error: Invalid type nature for generic argument. LINT is no Chars. +error: Invalid type nature for generic argument. LINT is no ANY_CHARS ┌─ :12:58 │ 12 │ FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LINT is no Chars. + │ ^ Invalid type nature for generic argument. LINT is no ANY_CHARS diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_reals.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_reals.snap index e5cdb6434e..9ba61fa049 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_reals.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_reals.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'REAL' to 'CHAR' 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'REAL' to 'CHAR' -error: Invalid type nature for generic argument. REAL is no Chars. +error: Invalid type nature for generic argument. REAL is no ANY_CHARS ┌─ :3:57 │ 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. REAL is no Chars. + │ ^ Invalid type nature for generic argument. REAL is no ANY_CHARS error: Invalid assignment: cannot assign 'LREAL' to 'CHAR' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'LREAL' to 'CHAR' 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'LREAL' to 'CHAR' -error: Invalid type nature for generic argument. LREAL is no Chars. +error: Invalid type nature for generic argument. LREAL is no ANY_CHARS ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LREAL is no Chars. + │ ^ Invalid type nature for generic argument. LREAL is no ANY_CHARS diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_time.snap index db90b9b0e1..17b6ef7308 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_time.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'TIME' to 'CHAR' 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME' to 'CHAR' -error: Invalid type nature for generic argument. TIME is no Chars. +error: Invalid type nature for generic argument. TIME is no ANY_CHARS ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Chars. + │ ^ Invalid type nature for generic argument. TIME is no ANY_CHARS error: Invalid assignment: cannot assign 'TIME' to 'CHAR' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'TIME' to 'CHAR' 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME' to 'CHAR' -error: Invalid type nature for generic argument. TIME is no Chars. +error: Invalid type nature for generic argument. TIME is no ANY_CHARS ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Chars. + │ ^ Invalid type nature for generic argument. TIME is no ANY_CHARS diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_multiple_parameters.snap index 620c8345a4..74e69313ca 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_multiple_parameters.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'REAL' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'REAL' to 'STRING' -error: Invalid type nature for generic argument. REAL is no Chars. +error: Invalid type nature for generic argument. REAL is no ANY_CHARS ┌─ :15:14 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no Chars. + │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no ANY_CHARS error: Invalid assignment: cannot assign 'UDINT' to 'STRING' ┌─ :15:24 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'UDINT' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^^^^^ Invalid assignment: cannot assign 'UDINT' to 'STRING' -error: Invalid type nature for generic argument. UDINT is no Chars. +error: Invalid type nature for generic argument. UDINT is no ANY_CHARS ┌─ :15:24 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no Chars. + │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no ANY_CHARS error: Invalid assignment: cannot assign 'DINT' to 'STRING' ┌─ :15:38 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'DINT' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^^^ Invalid assignment: cannot assign 'DINT' to 'STRING' -error: Invalid type nature for generic argument. DINT is no Chars. +error: Invalid type nature for generic argument. DINT is no ANY_CHARS ┌─ :15:38 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no Chars. + │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no ANY_CHARS error: Invalid assignment: cannot assign 'TIME' to 'STRING' ┌─ :15:50 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'TIME' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'TIME' to 'STRING' -error: Invalid type nature for generic argument. TIME is no Chars. +error: Invalid type nature for generic argument. TIME is no ANY_CHARS ┌─ :15:50 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no Chars. + │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_CHARS error: Invalid assignment: cannot assign 'BYTE' to 'STRING' ┌─ :15:60 @@ -56,11 +56,11 @@ error: Invalid assignment: cannot assign 'BYTE' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'BYTE' to 'STRING' -error: Invalid type nature for generic argument. BYTE is no Chars. +error: Invalid type nature for generic argument. BYTE is no ANY_CHARS ┌─ :15:60 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no Chars. + │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no ANY_CHARS error: Invalid assignment: cannot assign 'CHAR' to 'STRING' ┌─ :15:79 @@ -74,10 +74,10 @@ error: Invalid assignment: cannot assign 'DATE' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'DATE' to 'STRING' -error: Invalid type nature for generic argument. DATE is no Chars. +error: Invalid type nature for generic argument. DATE is no ANY_CHARS ┌─ :15:89 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no Chars. + │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no ANY_CHARS diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_bits.snap index 6ace8daa12..cb6f4528f1 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_bits.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. BOOL is no Date. +error: Invalid type nature for generic argument. BOOL is no ANY_DATE ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BOOL is no Date. + │ ^ Invalid type nature for generic argument. BOOL is no ANY_DATE -error: Invalid type nature for generic argument. BYTE is no Date. +error: Invalid type nature for generic argument. BYTE is no ANY_DATE ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BYTE is no Date. + │ ^ Invalid type nature for generic argument. BYTE is no ANY_DATE -error: Invalid type nature for generic argument. WORD is no Date. +error: Invalid type nature for generic argument. WORD is no ANY_DATE ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WORD is no Date. + │ ^ Invalid type nature for generic argument. WORD is no ANY_DATE -error: Invalid type nature for generic argument. DWORD is no Date. +error: Invalid type nature for generic argument. DWORD is no ANY_DATE ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DWORD is no Date. + │ ^ Invalid type nature for generic argument. DWORD is no ANY_DATE -error: Invalid type nature for generic argument. LWORD is no Date. +error: Invalid type nature for generic argument. LWORD is no ANY_DATE ┌─ :7:59 │ 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LWORD is no Date. + │ ^ Invalid type nature for generic argument. LWORD is no ANY_DATE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_chars.snap index d0eac5254d..466b4511b6 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_chars.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'CHAR' to 'DATE' 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'CHAR' to 'DATE' -error: Invalid type nature for generic argument. CHAR is no Date. +error: Invalid type nature for generic argument. CHAR is no ANY_DATE ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. CHAR is no Date. + │ ^ Invalid type nature for generic argument. CHAR is no ANY_DATE error: Invalid assignment: cannot assign 'WCHAR' to 'DATE' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WCHAR' to 'DATE' 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WCHAR' to 'DATE' -error: Invalid type nature for generic argument. WCHAR is no Date. +error: Invalid type nature for generic argument. WCHAR is no ANY_DATE ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WCHAR is no Date. + │ ^ Invalid type nature for generic argument. WCHAR is no ANY_DATE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_ints.snap index 421908b22a..0fa4a34970 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_ints.snap @@ -2,52 +2,52 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. USINT is no Date. +error: Invalid type nature for generic argument. USINT is no ANY_DATE ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. USINT is no Date. + │ ^ Invalid type nature for generic argument. USINT is no ANY_DATE -error: Invalid type nature for generic argument. UINT is no Date. +error: Invalid type nature for generic argument. UINT is no ANY_DATE ┌─ :5:58 │ 5 │ FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UINT is no Date. + │ ^ Invalid type nature for generic argument. UINT is no ANY_DATE -error: Invalid type nature for generic argument. UDINT is no Date. +error: Invalid type nature for generic argument. UDINT is no ANY_DATE ┌─ :6:59 │ 6 │ FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UDINT is no Date. + │ ^ Invalid type nature for generic argument. UDINT is no ANY_DATE -error: Invalid type nature for generic argument. ULINT is no Date. +error: Invalid type nature for generic argument. ULINT is no ANY_DATE ┌─ :7:59 │ 7 │ FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. ULINT is no Date. + │ ^ Invalid type nature for generic argument. ULINT is no ANY_DATE -error: Invalid type nature for generic argument. SINT is no Date. +error: Invalid type nature for generic argument. SINT is no ANY_DATE ┌─ :9:58 │ 9 │ FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. SINT is no Date. + │ ^ Invalid type nature for generic argument. SINT is no ANY_DATE -error: Invalid type nature for generic argument. INT is no Date. +error: Invalid type nature for generic argument. INT is no ANY_DATE ┌─ :10:57 │ 10 │ FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. INT is no Date. + │ ^ Invalid type nature for generic argument. INT is no ANY_DATE -error: Invalid type nature for generic argument. DINT is no Date. +error: Invalid type nature for generic argument. DINT is no ANY_DATE ┌─ :11:58 │ 11 │ FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DINT is no Date. + │ ^ Invalid type nature for generic argument. DINT is no ANY_DATE -error: Invalid type nature for generic argument. LINT is no Date. +error: Invalid type nature for generic argument. LINT is no ANY_DATE ┌─ :12:58 │ 12 │ FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LINT is no Date. + │ ^ Invalid type nature for generic argument. LINT is no ANY_DATE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_reals.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_reals.snap index 7cd736402e..4271e69a11 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_reals.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_reals.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Date. +error: Invalid type nature for generic argument. REAL is no ANY_DATE ┌─ :3:57 │ 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. REAL is no Date. + │ ^ Invalid type nature for generic argument. REAL is no ANY_DATE -error: Invalid type nature for generic argument. LREAL is no Date. +error: Invalid type nature for generic argument. LREAL is no ANY_DATE ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LREAL is no Date. + │ ^ Invalid type nature for generic argument. LREAL is no ANY_DATE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_string.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_string.snap index 2fc7e6a30f..7438756319 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_string.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_string.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'DATE' 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'STRING' to 'DATE' -error: Invalid type nature for generic argument. STRING is no Date. +error: Invalid type nature for generic argument. STRING is no ANY_DATE ┌─ :3:61 │ 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. STRING is no Date. + │ ^ Invalid type nature for generic argument. STRING is no ANY_DATE error: Invalid assignment: cannot assign 'WSTRING' to 'DATE' ┌─ :4:61 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WSTRING' to 'DATE' 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WSTRING' to 'DATE' -error: Invalid type nature for generic argument. WSTRING is no Date. +error: Invalid type nature for generic argument. WSTRING is no ANY_DATE ┌─ :4:61 │ 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WSTRING is no Date. + │ ^ Invalid type nature for generic argument. WSTRING is no ANY_DATE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_time.snap index 27d315be4f..49d74fc5dc 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_time.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. TIME is no Date. +error: Invalid type nature for generic argument. TIME is no ANY_DATE ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Date. + │ ^ Invalid type nature for generic argument. TIME is no ANY_DATE -error: Invalid type nature for generic argument. TIME is no Date. +error: Invalid type nature for generic argument. TIME is no ANY_DATE ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Date. + │ ^ Invalid type nature for generic argument. TIME is no ANY_DATE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_multiple_parameters.snap index ceccf60f90..86fec33ee2 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_multiple_parameters.snap @@ -2,35 +2,35 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Date. +error: Invalid type nature for generic argument. REAL is no ANY_DATE ┌─ :15:14 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no Date. + │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no ANY_DATE -error: Invalid type nature for generic argument. UDINT is no Date. +error: Invalid type nature for generic argument. UDINT is no ANY_DATE ┌─ :15:24 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no Date. + │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no ANY_DATE -error: Invalid type nature for generic argument. DINT is no Date. +error: Invalid type nature for generic argument. DINT is no ANY_DATE ┌─ :15:38 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no Date. + │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no ANY_DATE -error: Invalid type nature for generic argument. TIME is no Date. +error: Invalid type nature for generic argument. TIME is no ANY_DATE ┌─ :15:50 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no Date. + │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_DATE -error: Invalid type nature for generic argument. BYTE is no Date. +error: Invalid type nature for generic argument. BYTE is no ANY_DATE ┌─ :15:60 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no Date. + │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no ANY_DATE error: Invalid assignment: cannot assign 'STRING' to 'DATE' ┌─ :15:70 @@ -38,11 +38,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'DATE' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^ Invalid assignment: cannot assign 'STRING' to 'DATE' -error: Invalid type nature for generic argument. STRING is no Date. +error: Invalid type nature for generic argument. STRING is no ANY_DATE ┌─ :15:70 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^ Invalid type nature for generic argument. STRING is no Date. + │ ^^^^^^^ Invalid type nature for generic argument. STRING is no ANY_DATE error: Invalid assignment: cannot assign 'CHAR' to 'DATE' ┌─ :15:79 @@ -50,10 +50,10 @@ error: Invalid assignment: cannot assign 'CHAR' to 'DATE' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'CHAR' to 'DATE' -error: Invalid type nature for generic argument. CHAR is no Date. +error: Invalid type nature for generic argument. CHAR is no ANY_DATE ┌─ :15:79 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no Date. + │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no ANY_DATE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_bits.snap index e8ca3d9935..4ad6d5c1c2 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_bits.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. BOOL is no Duration. +error: Invalid type nature for generic argument. BOOL is no ANY_DURATION ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BOOL is no Duration. + │ ^ Invalid type nature for generic argument. BOOL is no ANY_DURATION -error: Invalid type nature for generic argument. BYTE is no Duration. +error: Invalid type nature for generic argument. BYTE is no ANY_DURATION ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BYTE is no Duration. + │ ^ Invalid type nature for generic argument. BYTE is no ANY_DURATION -error: Invalid type nature for generic argument. WORD is no Duration. +error: Invalid type nature for generic argument. WORD is no ANY_DURATION ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WORD is no Duration. + │ ^ Invalid type nature for generic argument. WORD is no ANY_DURATION -error: Invalid type nature for generic argument. DWORD is no Duration. +error: Invalid type nature for generic argument. DWORD is no ANY_DURATION ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DWORD is no Duration. + │ ^ Invalid type nature for generic argument. DWORD is no ANY_DURATION -error: Invalid type nature for generic argument. LWORD is no Duration. +error: Invalid type nature for generic argument. LWORD is no ANY_DURATION ┌─ :7:59 │ 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LWORD is no Duration. + │ ^ Invalid type nature for generic argument. LWORD is no ANY_DURATION diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_chars.snap index 2f09f4cc9f..62d4ef34e7 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_chars.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'CHAR' to 'TIME' 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'CHAR' to 'TIME' -error: Invalid type nature for generic argument. CHAR is no Duration. +error: Invalid type nature for generic argument. CHAR is no ANY_DURATION ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. CHAR is no Duration. + │ ^ Invalid type nature for generic argument. CHAR is no ANY_DURATION error: Invalid assignment: cannot assign 'WCHAR' to 'TIME' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WCHAR' to 'TIME' 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WCHAR' to 'TIME' -error: Invalid type nature for generic argument. WCHAR is no Duration. +error: Invalid type nature for generic argument. WCHAR is no ANY_DURATION ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WCHAR is no Duration. + │ ^ Invalid type nature for generic argument. WCHAR is no ANY_DURATION diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_date.snap index 0e4acd19f3..e9de756f91 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_date.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. DATE_AND_TIME is no Duration. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_DURATION ┌─ :3:56 │ 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Duration. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_DURATION -error: Invalid type nature for generic argument. DATE_AND_TIME is no Duration. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_DURATION ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Duration. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_DURATION -error: Invalid type nature for generic argument. DATE is no Duration. +error: Invalid type nature for generic argument. DATE is no ANY_DURATION ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE is no Duration. + │ ^ Invalid type nature for generic argument. DATE is no ANY_DURATION -error: Invalid type nature for generic argument. TIME_OF_DAY is no Duration. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_DURATION ┌─ :6:57 │ 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Duration. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_DURATION -error: Invalid type nature for generic argument. TIME_OF_DAY is no Duration. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_DURATION ┌─ :7:58 │ 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Duration. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_DURATION diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_ints.snap index 44ecfd8305..f9877f3586 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_ints.snap @@ -2,52 +2,52 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. USINT is no Duration. +error: Invalid type nature for generic argument. USINT is no ANY_DURATION ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. USINT is no Duration. + │ ^ Invalid type nature for generic argument. USINT is no ANY_DURATION -error: Invalid type nature for generic argument. UINT is no Duration. +error: Invalid type nature for generic argument. UINT is no ANY_DURATION ┌─ :5:58 │ 5 │ FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UINT is no Duration. + │ ^ Invalid type nature for generic argument. UINT is no ANY_DURATION -error: Invalid type nature for generic argument. UDINT is no Duration. +error: Invalid type nature for generic argument. UDINT is no ANY_DURATION ┌─ :6:59 │ 6 │ FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UDINT is no Duration. + │ ^ Invalid type nature for generic argument. UDINT is no ANY_DURATION -error: Invalid type nature for generic argument. ULINT is no Duration. +error: Invalid type nature for generic argument. ULINT is no ANY_DURATION ┌─ :7:59 │ 7 │ FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. ULINT is no Duration. + │ ^ Invalid type nature for generic argument. ULINT is no ANY_DURATION -error: Invalid type nature for generic argument. SINT is no Duration. +error: Invalid type nature for generic argument. SINT is no ANY_DURATION ┌─ :9:58 │ 9 │ FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. SINT is no Duration. + │ ^ Invalid type nature for generic argument. SINT is no ANY_DURATION -error: Invalid type nature for generic argument. INT is no Duration. +error: Invalid type nature for generic argument. INT is no ANY_DURATION ┌─ :10:57 │ 10 │ FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. INT is no Duration. + │ ^ Invalid type nature for generic argument. INT is no ANY_DURATION -error: Invalid type nature for generic argument. DINT is no Duration. +error: Invalid type nature for generic argument. DINT is no ANY_DURATION ┌─ :11:58 │ 11 │ FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DINT is no Duration. + │ ^ Invalid type nature for generic argument. DINT is no ANY_DURATION -error: Invalid type nature for generic argument. LINT is no Duration. +error: Invalid type nature for generic argument. LINT is no ANY_DURATION ┌─ :12:58 │ 12 │ FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LINT is no Duration. + │ ^ Invalid type nature for generic argument. LINT is no ANY_DURATION diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_reals.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_reals.snap index e6e156a737..4f19b3519a 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_reals.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_reals.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Duration. +error: Invalid type nature for generic argument. REAL is no ANY_DURATION ┌─ :3:57 │ 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. REAL is no Duration. + │ ^ Invalid type nature for generic argument. REAL is no ANY_DURATION -error: Invalid type nature for generic argument. LREAL is no Duration. +error: Invalid type nature for generic argument. LREAL is no ANY_DURATION ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LREAL is no Duration. + │ ^ Invalid type nature for generic argument. LREAL is no ANY_DURATION diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_string.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_string.snap index d878b01e93..38fbb76740 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_string.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_string.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'TIME' 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'STRING' to 'TIME' -error: Invalid type nature for generic argument. STRING is no Duration. +error: Invalid type nature for generic argument. STRING is no ANY_DURATION ┌─ :3:61 │ 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. STRING is no Duration. + │ ^ Invalid type nature for generic argument. STRING is no ANY_DURATION error: Invalid assignment: cannot assign 'WSTRING' to 'TIME' ┌─ :4:61 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WSTRING' to 'TIME' 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WSTRING' to 'TIME' -error: Invalid type nature for generic argument. WSTRING is no Duration. +error: Invalid type nature for generic argument. WSTRING is no ANY_DURATION ┌─ :4:61 │ 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WSTRING is no Duration. + │ ^ Invalid type nature for generic argument. WSTRING is no ANY_DURATION diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_multiple_parameters.snap index 3679326b2c..d60eca5ba4 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_multiple_parameters.snap @@ -2,29 +2,29 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Duration. +error: Invalid type nature for generic argument. REAL is no ANY_DURATION ┌─ :15:14 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no Duration. + │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no ANY_DURATION -error: Invalid type nature for generic argument. UDINT is no Duration. +error: Invalid type nature for generic argument. UDINT is no ANY_DURATION ┌─ :15:24 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no Duration. + │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no ANY_DURATION -error: Invalid type nature for generic argument. DINT is no Duration. +error: Invalid type nature for generic argument. DINT is no ANY_DURATION ┌─ :15:38 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no Duration. + │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no ANY_DURATION -error: Invalid type nature for generic argument. BYTE is no Duration. +error: Invalid type nature for generic argument. BYTE is no ANY_DURATION ┌─ :15:60 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no Duration. + │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no ANY_DURATION error: Invalid assignment: cannot assign 'STRING' to 'TIME' ┌─ :15:70 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'TIME' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^ Invalid assignment: cannot assign 'STRING' to 'TIME' -error: Invalid type nature for generic argument. STRING is no Duration. +error: Invalid type nature for generic argument. STRING is no ANY_DURATION ┌─ :15:70 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^ Invalid type nature for generic argument. STRING is no Duration. + │ ^^^^^^^ Invalid type nature for generic argument. STRING is no ANY_DURATION error: Invalid assignment: cannot assign 'CHAR' to 'TIME' ┌─ :15:79 @@ -44,16 +44,16 @@ error: Invalid assignment: cannot assign 'CHAR' to 'TIME' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'CHAR' to 'TIME' -error: Invalid type nature for generic argument. CHAR is no Duration. +error: Invalid type nature for generic argument. CHAR is no ANY_DURATION ┌─ :15:79 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no Duration. + │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no ANY_DURATION -error: Invalid type nature for generic argument. DATE is no Duration. +error: Invalid type nature for generic argument. DATE is no ANY_DURATION ┌─ :15:89 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no Duration. + │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no ANY_DURATION diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_bits.snap index 43419695c2..5f1f260988 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_bits.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. BOOL is no Int. +error: Invalid type nature for generic argument. BOOL is no ANY_INT ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BOOL is no Int. + │ ^ Invalid type nature for generic argument. BOOL is no ANY_INT -error: Invalid type nature for generic argument. BYTE is no Int. +error: Invalid type nature for generic argument. BYTE is no ANY_INT ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BYTE is no Int. + │ ^ Invalid type nature for generic argument. BYTE is no ANY_INT -error: Invalid type nature for generic argument. WORD is no Int. +error: Invalid type nature for generic argument. WORD is no ANY_INT ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WORD is no Int. + │ ^ Invalid type nature for generic argument. WORD is no ANY_INT -error: Invalid type nature for generic argument. DWORD is no Int. +error: Invalid type nature for generic argument. DWORD is no ANY_INT ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DWORD is no Int. + │ ^ Invalid type nature for generic argument. DWORD is no ANY_INT -error: Invalid type nature for generic argument. LWORD is no Int. +error: Invalid type nature for generic argument. LWORD is no ANY_INT ┌─ :7:59 │ 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LWORD is no Int. + │ ^ Invalid type nature for generic argument. LWORD is no ANY_INT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_chars.snap index 3f964e6123..25c6632c05 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_chars.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'CHAR' to 'USINT' 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'CHAR' to 'USINT' -error: Invalid type nature for generic argument. CHAR is no Int. +error: Invalid type nature for generic argument. CHAR is no ANY_INT ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. CHAR is no Int. + │ ^ Invalid type nature for generic argument. CHAR is no ANY_INT error: Invalid assignment: cannot assign 'WCHAR' to 'USINT' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WCHAR' to 'USINT' 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WCHAR' to 'USINT' -error: Invalid type nature for generic argument. WCHAR is no Int. +error: Invalid type nature for generic argument. WCHAR is no ANY_INT ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WCHAR is no Int. + │ ^ Invalid type nature for generic argument. WCHAR is no ANY_INT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_date.snap index 27e18918e7..2a757d1135 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_date.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. DATE_AND_TIME is no Int. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_INT ┌─ :3:56 │ 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Int. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_INT -error: Invalid type nature for generic argument. DATE_AND_TIME is no Int. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_INT ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Int. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_INT -error: Invalid type nature for generic argument. DATE is no Int. +error: Invalid type nature for generic argument. DATE is no ANY_INT ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE is no Int. + │ ^ Invalid type nature for generic argument. DATE is no ANY_INT -error: Invalid type nature for generic argument. TIME_OF_DAY is no Int. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_INT ┌─ :6:57 │ 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Int. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_INT -error: Invalid type nature for generic argument. TIME_OF_DAY is no Int. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_INT ┌─ :7:58 │ 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Int. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_INT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_reals.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_reals.snap index 017e924c29..3d74075a44 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_reals.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_reals.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Int. +error: Invalid type nature for generic argument. REAL is no ANY_INT ┌─ :3:57 │ 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. REAL is no Int. + │ ^ Invalid type nature for generic argument. REAL is no ANY_INT -error: Invalid type nature for generic argument. LREAL is no Int. +error: Invalid type nature for generic argument. LREAL is no ANY_INT ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LREAL is no Int. + │ ^ Invalid type nature for generic argument. LREAL is no ANY_INT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_string.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_string.snap index d1ba5ec0e1..dabc5789b5 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_string.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_string.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'USINT' 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'STRING' to 'USINT' -error: Invalid type nature for generic argument. STRING is no Int. +error: Invalid type nature for generic argument. STRING is no ANY_INT ┌─ :3:61 │ 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. STRING is no Int. + │ ^ Invalid type nature for generic argument. STRING is no ANY_INT error: Invalid assignment: cannot assign 'WSTRING' to 'USINT' ┌─ :4:61 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WSTRING' to 'USINT' 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WSTRING' to 'USINT' -error: Invalid type nature for generic argument. WSTRING is no Int. +error: Invalid type nature for generic argument. WSTRING is no ANY_INT ┌─ :4:61 │ 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WSTRING is no Int. + │ ^ Invalid type nature for generic argument. WSTRING is no ANY_INT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_time.snap index 00ff188a46..07f30d742e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_time.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. TIME is no Int. +error: Invalid type nature for generic argument. TIME is no ANY_INT ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Int. + │ ^ Invalid type nature for generic argument. TIME is no ANY_INT -error: Invalid type nature for generic argument. TIME is no Int. +error: Invalid type nature for generic argument. TIME is no ANY_INT ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Int. + │ ^ Invalid type nature for generic argument. TIME is no ANY_INT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_multiple_parameters.snap index 4a87c24f97..9d2358d48a 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_multiple_parameters.snap @@ -2,23 +2,23 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Int. +error: Invalid type nature for generic argument. REAL is no ANY_INT ┌─ :15:14 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no Int. + │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no ANY_INT -error: Invalid type nature for generic argument. TIME is no Int. +error: Invalid type nature for generic argument. TIME is no ANY_INT ┌─ :15:50 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no Int. + │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_INT -error: Invalid type nature for generic argument. BYTE is no Int. +error: Invalid type nature for generic argument. BYTE is no ANY_INT ┌─ :15:60 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no Int. + │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no ANY_INT error: Invalid assignment: cannot assign 'STRING' to 'DINT' ┌─ :15:70 @@ -26,11 +26,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'DINT' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^ Invalid assignment: cannot assign 'STRING' to 'DINT' -error: Invalid type nature for generic argument. STRING is no Int. +error: Invalid type nature for generic argument. STRING is no ANY_INT ┌─ :15:70 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^ Invalid type nature for generic argument. STRING is no Int. + │ ^^^^^^^ Invalid type nature for generic argument. STRING is no ANY_INT error: Invalid assignment: cannot assign 'CHAR' to 'DINT' ┌─ :15:79 @@ -38,16 +38,16 @@ error: Invalid assignment: cannot assign 'CHAR' to 'DINT' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'CHAR' to 'DINT' -error: Invalid type nature for generic argument. CHAR is no Int. +error: Invalid type nature for generic argument. CHAR is no ANY_INT ┌─ :15:79 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no Int. + │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no ANY_INT -error: Invalid type nature for generic argument. DATE is no Int. +error: Invalid type nature for generic argument. DATE is no ANY_INT ┌─ :15:89 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no Int. + │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no ANY_INT diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_bits.snap index 4d5b3a6032..a144d12335 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_bits.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. BOOL is no Magnitude. +error: Invalid type nature for generic argument. BOOL is no ANY_MAGNITUDE ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BOOL is no Magnitude. + │ ^ Invalid type nature for generic argument. BOOL is no ANY_MAGNITUDE -error: Invalid type nature for generic argument. BYTE is no Magnitude. +error: Invalid type nature for generic argument. BYTE is no ANY_MAGNITUDE ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BYTE is no Magnitude. + │ ^ Invalid type nature for generic argument. BYTE is no ANY_MAGNITUDE -error: Invalid type nature for generic argument. WORD is no Magnitude. +error: Invalid type nature for generic argument. WORD is no ANY_MAGNITUDE ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WORD is no Magnitude. + │ ^ Invalid type nature for generic argument. WORD is no ANY_MAGNITUDE -error: Invalid type nature for generic argument. DWORD is no Magnitude. +error: Invalid type nature for generic argument. DWORD is no ANY_MAGNITUDE ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DWORD is no Magnitude. + │ ^ Invalid type nature for generic argument. DWORD is no ANY_MAGNITUDE -error: Invalid type nature for generic argument. LWORD is no Magnitude. +error: Invalid type nature for generic argument. LWORD is no ANY_MAGNITUDE ┌─ :7:59 │ 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LWORD is no Magnitude. + │ ^ Invalid type nature for generic argument. LWORD is no ANY_MAGNITUDE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_chars.snap index 8b76a7ff85..f373e84358 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_chars.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'CHAR' to 'USINT' 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'CHAR' to 'USINT' -error: Invalid type nature for generic argument. CHAR is no Magnitude. +error: Invalid type nature for generic argument. CHAR is no ANY_MAGNITUDE ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. CHAR is no Magnitude. + │ ^ Invalid type nature for generic argument. CHAR is no ANY_MAGNITUDE error: Invalid assignment: cannot assign 'WCHAR' to 'USINT' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WCHAR' to 'USINT' 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WCHAR' to 'USINT' -error: Invalid type nature for generic argument. WCHAR is no Magnitude. +error: Invalid type nature for generic argument. WCHAR is no ANY_MAGNITUDE ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WCHAR is no Magnitude. + │ ^ Invalid type nature for generic argument. WCHAR is no ANY_MAGNITUDE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_date.snap index 923b43c2c6..01373f7dfd 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_date.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. DATE_AND_TIME is no Magnitude. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_MAGNITUDE ┌─ :3:56 │ 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Magnitude. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_MAGNITUDE -error: Invalid type nature for generic argument. DATE_AND_TIME is no Magnitude. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_MAGNITUDE ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Magnitude. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_MAGNITUDE -error: Invalid type nature for generic argument. DATE is no Magnitude. +error: Invalid type nature for generic argument. DATE is no ANY_MAGNITUDE ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE is no Magnitude. + │ ^ Invalid type nature for generic argument. DATE is no ANY_MAGNITUDE -error: Invalid type nature for generic argument. TIME_OF_DAY is no Magnitude. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_MAGNITUDE ┌─ :6:57 │ 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Magnitude. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_MAGNITUDE -error: Invalid type nature for generic argument. TIME_OF_DAY is no Magnitude. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_MAGNITUDE ┌─ :7:58 │ 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Magnitude. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_MAGNITUDE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_strings.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_strings.snap index f0020a8736..1166ac6416 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_strings.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_strings.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'USINT' 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'STRING' to 'USINT' -error: Invalid type nature for generic argument. STRING is no Magnitude. +error: Invalid type nature for generic argument. STRING is no ANY_MAGNITUDE ┌─ :3:60 │ 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. STRING is no Magnitude. + │ ^ Invalid type nature for generic argument. STRING is no ANY_MAGNITUDE error: Invalid assignment: cannot assign 'WSTRING' to 'USINT' ┌─ :4:61 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WSTRING' to 'USINT' 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WSTRING' to 'USINT' -error: Invalid type nature for generic argument. WSTRING is no Magnitude. +error: Invalid type nature for generic argument. WSTRING is no ANY_MAGNITUDE ┌─ :4:61 │ 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WSTRING is no Magnitude. + │ ^ Invalid type nature for generic argument. WSTRING is no ANY_MAGNITUDE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_multiple_parameters.snap index f53e2e03a2..838546b94e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_multiple_parameters.snap @@ -2,11 +2,11 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. BYTE is no Magnitude. +error: Invalid type nature for generic argument. BYTE is no ANY_MAGNITUDE ┌─ :15:60 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no Magnitude. + │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no ANY_MAGNITUDE error: Invalid assignment: cannot assign 'STRING' to 'TIME' ┌─ :15:70 @@ -14,11 +14,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'TIME' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^ Invalid assignment: cannot assign 'STRING' to 'TIME' -error: Invalid type nature for generic argument. STRING is no Magnitude. +error: Invalid type nature for generic argument. STRING is no ANY_MAGNITUDE ┌─ :15:70 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^ Invalid type nature for generic argument. STRING is no Magnitude. + │ ^^^^^^^ Invalid type nature for generic argument. STRING is no ANY_MAGNITUDE error: Invalid assignment: cannot assign 'CHAR' to 'TIME' ┌─ :15:79 @@ -26,16 +26,16 @@ error: Invalid assignment: cannot assign 'CHAR' to 'TIME' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'CHAR' to 'TIME' -error: Invalid type nature for generic argument. CHAR is no Magnitude. +error: Invalid type nature for generic argument. CHAR is no ANY_MAGNITUDE ┌─ :15:79 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no Magnitude. + │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no ANY_MAGNITUDE -error: Invalid type nature for generic argument. DATE is no Magnitude. +error: Invalid type nature for generic argument. DATE is no ANY_MAGNITUDE ┌─ :15:89 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no Magnitude. + │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no ANY_MAGNITUDE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_bits.snap index bc1dced5f7..a274a557a1 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_bits.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. BOOL is no Num. +error: Invalid type nature for generic argument. BOOL is no ANY_NUMBER ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BOOL is no Num. + │ ^ Invalid type nature for generic argument. BOOL is no ANY_NUMBER -error: Invalid type nature for generic argument. BYTE is no Num. +error: Invalid type nature for generic argument. BYTE is no ANY_NUMBER ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BYTE is no Num. + │ ^ Invalid type nature for generic argument. BYTE is no ANY_NUMBER -error: Invalid type nature for generic argument. WORD is no Num. +error: Invalid type nature for generic argument. WORD is no ANY_NUMBER ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WORD is no Num. + │ ^ Invalid type nature for generic argument. WORD is no ANY_NUMBER -error: Invalid type nature for generic argument. DWORD is no Num. +error: Invalid type nature for generic argument. DWORD is no ANY_NUMBER ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DWORD is no Num. + │ ^ Invalid type nature for generic argument. DWORD is no ANY_NUMBER -error: Invalid type nature for generic argument. LWORD is no Num. +error: Invalid type nature for generic argument. LWORD is no ANY_NUMBER ┌─ :7:59 │ 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LWORD is no Num. + │ ^ Invalid type nature for generic argument. LWORD is no ANY_NUMBER diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_chars.snap index d404a5389b..762e8457ff 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_chars.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'CHAR' to 'USINT' 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'CHAR' to 'USINT' -error: Invalid type nature for generic argument. CHAR is no Num. +error: Invalid type nature for generic argument. CHAR is no ANY_NUMBER ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. CHAR is no Num. + │ ^ Invalid type nature for generic argument. CHAR is no ANY_NUMBER error: Invalid assignment: cannot assign 'WCHAR' to 'USINT' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WCHAR' to 'USINT' 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WCHAR' to 'USINT' -error: Invalid type nature for generic argument. WCHAR is no Num. +error: Invalid type nature for generic argument. WCHAR is no ANY_NUMBER ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WCHAR is no Num. + │ ^ Invalid type nature for generic argument. WCHAR is no ANY_NUMBER diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_date.snap index f9ac77beea..7624b00a8e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_date.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. DATE_AND_TIME is no Num. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_NUMBER ┌─ :3:56 │ 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Num. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_NUMBER -error: Invalid type nature for generic argument. DATE_AND_TIME is no Num. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_NUMBER ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Num. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_NUMBER -error: Invalid type nature for generic argument. DATE is no Num. +error: Invalid type nature for generic argument. DATE is no ANY_NUMBER ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE is no Num. + │ ^ Invalid type nature for generic argument. DATE is no ANY_NUMBER -error: Invalid type nature for generic argument. TIME_OF_DAY is no Num. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_NUMBER ┌─ :6:57 │ 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Num. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_NUMBER -error: Invalid type nature for generic argument. TIME_OF_DAY is no Num. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_NUMBER ┌─ :7:58 │ 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Num. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_NUMBER diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_strings.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_strings.snap index 4ad2e4c6a8..93509773c4 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_strings.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_strings.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'USINT' 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'STRING' to 'USINT' -error: Invalid type nature for generic argument. STRING is no Num. +error: Invalid type nature for generic argument. STRING is no ANY_NUMBER ┌─ :3:60 │ 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. STRING is no Num. + │ ^ Invalid type nature for generic argument. STRING is no ANY_NUMBER error: Invalid assignment: cannot assign 'WSTRING' to 'USINT' ┌─ :4:61 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WSTRING' to 'USINT' 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WSTRING' to 'USINT' -error: Invalid type nature for generic argument. WSTRING is no Num. +error: Invalid type nature for generic argument. WSTRING is no ANY_NUMBER ┌─ :4:61 │ 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WSTRING is no Num. + │ ^ Invalid type nature for generic argument. WSTRING is no ANY_NUMBER diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_time.snap index f51a4020d9..f95fea3ef9 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_time.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. TIME is no Num. +error: Invalid type nature for generic argument. TIME is no ANY_NUMBER ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Num. + │ ^ Invalid type nature for generic argument. TIME is no ANY_NUMBER -error: Invalid type nature for generic argument. TIME is no Num. +error: Invalid type nature for generic argument. TIME is no ANY_NUMBER ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Num. + │ ^ Invalid type nature for generic argument. TIME is no ANY_NUMBER diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_multiple_parameters.snap index 9bbd34a83a..b81d3cd0b0 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_multiple_parameters.snap @@ -2,17 +2,17 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. TIME is no Num. +error: Invalid type nature for generic argument. TIME is no ANY_NUMBER ┌─ :15:50 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no Num. + │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_NUMBER -error: Invalid type nature for generic argument. BYTE is no Num. +error: Invalid type nature for generic argument. BYTE is no ANY_NUMBER ┌─ :15:60 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no Num. + │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no ANY_NUMBER error: Invalid assignment: cannot assign 'STRING' to 'REAL' ┌─ :15:70 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'REAL' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^ Invalid assignment: cannot assign 'STRING' to 'REAL' -error: Invalid type nature for generic argument. STRING is no Num. +error: Invalid type nature for generic argument. STRING is no ANY_NUMBER ┌─ :15:70 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^ Invalid type nature for generic argument. STRING is no Num. + │ ^^^^^^^ Invalid type nature for generic argument. STRING is no ANY_NUMBER error: Invalid assignment: cannot assign 'CHAR' to 'REAL' ┌─ :15:79 @@ -32,16 +32,16 @@ error: Invalid assignment: cannot assign 'CHAR' to 'REAL' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'CHAR' to 'REAL' -error: Invalid type nature for generic argument. CHAR is no Num. +error: Invalid type nature for generic argument. CHAR is no ANY_NUMBER ┌─ :15:79 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no Num. + │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no ANY_NUMBER -error: Invalid type nature for generic argument. DATE is no Num. +error: Invalid type nature for generic argument. DATE is no ANY_NUMBER ┌─ :15:89 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no Num. + │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no ANY_NUMBER diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_bits.snap index afb286323d..8afbcb8c2e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_bits.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. BOOL is no Real. +error: Invalid type nature for generic argument. BOOL is no ANY_REAL ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BOOL is no Real. + │ ^ Invalid type nature for generic argument. BOOL is no ANY_REAL -error: Invalid type nature for generic argument. BYTE is no Real. +error: Invalid type nature for generic argument. BYTE is no ANY_REAL ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BYTE is no Real. + │ ^ Invalid type nature for generic argument. BYTE is no ANY_REAL -error: Invalid type nature for generic argument. WORD is no Real. +error: Invalid type nature for generic argument. WORD is no ANY_REAL ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WORD is no Real. + │ ^ Invalid type nature for generic argument. WORD is no ANY_REAL -error: Invalid type nature for generic argument. DWORD is no Real. +error: Invalid type nature for generic argument. DWORD is no ANY_REAL ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DWORD is no Real. + │ ^ Invalid type nature for generic argument. DWORD is no ANY_REAL -error: Invalid type nature for generic argument. LWORD is no Real. +error: Invalid type nature for generic argument. LWORD is no ANY_REAL ┌─ :7:59 │ 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LWORD is no Real. + │ ^ Invalid type nature for generic argument. LWORD is no ANY_REAL diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_chars.snap index b070f5217e..ecf94dabc5 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_chars.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'CHAR' to 'REAL' 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'CHAR' to 'REAL' -error: Invalid type nature for generic argument. CHAR is no Real. +error: Invalid type nature for generic argument. CHAR is no ANY_REAL ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. CHAR is no Real. + │ ^ Invalid type nature for generic argument. CHAR is no ANY_REAL error: Invalid assignment: cannot assign 'WCHAR' to 'REAL' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WCHAR' to 'REAL' 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WCHAR' to 'REAL' -error: Invalid type nature for generic argument. WCHAR is no Real. +error: Invalid type nature for generic argument. WCHAR is no ANY_REAL ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WCHAR is no Real. + │ ^ Invalid type nature for generic argument. WCHAR is no ANY_REAL diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_date.snap index 320d5c32e7..a697a166bf 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_date.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. DATE_AND_TIME is no Real. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_REAL ┌─ :3:56 │ 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Real. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_REAL -error: Invalid type nature for generic argument. DATE_AND_TIME is no Real. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_REAL ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Real. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_REAL -error: Invalid type nature for generic argument. DATE is no Real. +error: Invalid type nature for generic argument. DATE is no ANY_REAL ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE is no Real. + │ ^ Invalid type nature for generic argument. DATE is no ANY_REAL -error: Invalid type nature for generic argument. TIME_OF_DAY is no Real. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_REAL ┌─ :6:57 │ 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Real. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_REAL -error: Invalid type nature for generic argument. TIME_OF_DAY is no Real. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_REAL ┌─ :7:58 │ 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Real. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_REAL diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_string.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_string.snap index 12f605053f..e679954fb4 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_string.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_string.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'REAL' 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'STRING' to 'REAL' -error: Invalid type nature for generic argument. STRING is no Real. +error: Invalid type nature for generic argument. STRING is no ANY_REAL ┌─ :3:61 │ 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. STRING is no Real. + │ ^ Invalid type nature for generic argument. STRING is no ANY_REAL error: Invalid assignment: cannot assign 'WSTRING' to 'REAL' ┌─ :4:61 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WSTRING' to 'REAL' 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WSTRING' to 'REAL' -error: Invalid type nature for generic argument. WSTRING is no Real. +error: Invalid type nature for generic argument. WSTRING is no ANY_REAL ┌─ :4:61 │ 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WSTRING is no Real. + │ ^ Invalid type nature for generic argument. WSTRING is no ANY_REAL diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_time.snap index 1123655367..aa6e9209dc 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_time.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. TIME is no Real. +error: Invalid type nature for generic argument. TIME is no ANY_REAL ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Real. + │ ^ Invalid type nature for generic argument. TIME is no ANY_REAL -error: Invalid type nature for generic argument. TIME is no Real. +error: Invalid type nature for generic argument. TIME is no ANY_REAL ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Real. + │ ^ Invalid type nature for generic argument. TIME is no ANY_REAL diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_multiple_parameters.snap index 9a54a74a17..26514c55f4 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_multiple_parameters.snap @@ -2,17 +2,17 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. TIME is no Real. +error: Invalid type nature for generic argument. TIME is no ANY_REAL ┌─ :15:50 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no Real. + │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_REAL -error: Invalid type nature for generic argument. BYTE is no Real. +error: Invalid type nature for generic argument. BYTE is no ANY_REAL ┌─ :15:60 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no Real. + │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no ANY_REAL error: Invalid assignment: cannot assign 'STRING' to 'REAL' ┌─ :15:70 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'REAL' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^ Invalid assignment: cannot assign 'STRING' to 'REAL' -error: Invalid type nature for generic argument. STRING is no Real. +error: Invalid type nature for generic argument. STRING is no ANY_REAL ┌─ :15:70 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^ Invalid type nature for generic argument. STRING is no Real. + │ ^^^^^^^ Invalid type nature for generic argument. STRING is no ANY_REAL error: Invalid assignment: cannot assign 'CHAR' to 'REAL' ┌─ :15:79 @@ -32,16 +32,16 @@ error: Invalid assignment: cannot assign 'CHAR' to 'REAL' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'CHAR' to 'REAL' -error: Invalid type nature for generic argument. CHAR is no Real. +error: Invalid type nature for generic argument. CHAR is no ANY_REAL ┌─ :15:79 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no Real. + │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no ANY_REAL -error: Invalid type nature for generic argument. DATE is no Real. +error: Invalid type nature for generic argument. DATE is no ANY_REAL ┌─ :15:89 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no Real. + │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no ANY_REAL diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_bits.snap index bafa2b092c..7518ca75c2 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_bits.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. BOOL is no Signed. +error: Invalid type nature for generic argument. BOOL is no ANY_SIGNED ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BOOL is no Signed. + │ ^ Invalid type nature for generic argument. BOOL is no ANY_SIGNED -error: Invalid type nature for generic argument. BYTE is no Signed. +error: Invalid type nature for generic argument. BYTE is no ANY_SIGNED ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BYTE is no Signed. + │ ^ Invalid type nature for generic argument. BYTE is no ANY_SIGNED -error: Invalid type nature for generic argument. WORD is no Signed. +error: Invalid type nature for generic argument. WORD is no ANY_SIGNED ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WORD is no Signed. + │ ^ Invalid type nature for generic argument. WORD is no ANY_SIGNED -error: Invalid type nature for generic argument. DWORD is no Signed. +error: Invalid type nature for generic argument. DWORD is no ANY_SIGNED ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DWORD is no Signed. + │ ^ Invalid type nature for generic argument. DWORD is no ANY_SIGNED -error: Invalid type nature for generic argument. LWORD is no Signed. +error: Invalid type nature for generic argument. LWORD is no ANY_SIGNED ┌─ :7:59 │ 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LWORD is no Signed. + │ ^ Invalid type nature for generic argument. LWORD is no ANY_SIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_chars.snap index 89736a966c..72fb259228 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_chars.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'CHAR' to 'SINT' 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'CHAR' to 'SINT' -error: Invalid type nature for generic argument. CHAR is no Signed. +error: Invalid type nature for generic argument. CHAR is no ANY_SIGNED ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. CHAR is no Signed. + │ ^ Invalid type nature for generic argument. CHAR is no ANY_SIGNED error: Invalid assignment: cannot assign 'WCHAR' to 'SINT' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WCHAR' to 'SINT' 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WCHAR' to 'SINT' -error: Invalid type nature for generic argument. WCHAR is no Signed. +error: Invalid type nature for generic argument. WCHAR is no ANY_SIGNED ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WCHAR is no Signed. + │ ^ Invalid type nature for generic argument. WCHAR is no ANY_SIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_date.snap index a42147a337..7c686f0232 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_date.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. DATE_AND_TIME is no Signed. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_SIGNED ┌─ :3:56 │ 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Signed. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_SIGNED -error: Invalid type nature for generic argument. DATE_AND_TIME is no Signed. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_SIGNED ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Signed. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_SIGNED -error: Invalid type nature for generic argument. DATE is no Signed. +error: Invalid type nature for generic argument. DATE is no ANY_SIGNED ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE is no Signed. + │ ^ Invalid type nature for generic argument. DATE is no ANY_SIGNED -error: Invalid type nature for generic argument. TIME_OF_DAY is no Signed. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_SIGNED ┌─ :6:57 │ 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Signed. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_SIGNED -error: Invalid type nature for generic argument. TIME_OF_DAY is no Signed. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_SIGNED ┌─ :7:58 │ 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Signed. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_SIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_reals.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_reals.snap index a2451a885d..1a02983d31 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_reals.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_reals.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Signed. +error: Invalid type nature for generic argument. REAL is no ANY_SIGNED ┌─ :3:57 │ 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. REAL is no Signed. + │ ^ Invalid type nature for generic argument. REAL is no ANY_SIGNED -error: Invalid type nature for generic argument. LREAL is no Signed. +error: Invalid type nature for generic argument. LREAL is no ANY_SIGNED ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LREAL is no Signed. + │ ^ Invalid type nature for generic argument. LREAL is no ANY_SIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_string.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_string.snap index 6792f138d2..3bbf12d6a6 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_string.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_string.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'SINT' 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'STRING' to 'SINT' -error: Invalid type nature for generic argument. STRING is no Signed. +error: Invalid type nature for generic argument. STRING is no ANY_SIGNED ┌─ :3:61 │ 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. STRING is no Signed. + │ ^ Invalid type nature for generic argument. STRING is no ANY_SIGNED error: Invalid assignment: cannot assign 'WSTRING' to 'SINT' ┌─ :4:61 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WSTRING' to 'SINT' 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WSTRING' to 'SINT' -error: Invalid type nature for generic argument. WSTRING is no Signed. +error: Invalid type nature for generic argument. WSTRING is no ANY_SIGNED ┌─ :4:61 │ 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WSTRING is no Signed. + │ ^ Invalid type nature for generic argument. WSTRING is no ANY_SIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_time.snap index 2bc83b9ec4..5450e7b5da 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_time.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. TIME is no Signed. +error: Invalid type nature for generic argument. TIME is no ANY_SIGNED ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Signed. + │ ^ Invalid type nature for generic argument. TIME is no ANY_SIGNED -error: Invalid type nature for generic argument. TIME is no Signed. +error: Invalid type nature for generic argument. TIME is no ANY_SIGNED ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Signed. + │ ^ Invalid type nature for generic argument. TIME is no ANY_SIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_unsigned_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_unsigned_ints.snap index 0575ab186d..a4c4b30997 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_unsigned_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_unsigned_ints.snap @@ -2,28 +2,28 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. USINT is no Signed. +error: Invalid type nature for generic argument. USINT is no ANY_SIGNED ┌─ :3:59 │ 3 │ FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. USINT is no Signed. + │ ^ Invalid type nature for generic argument. USINT is no ANY_SIGNED -error: Invalid type nature for generic argument. UINT is no Signed. +error: Invalid type nature for generic argument. UINT is no ANY_SIGNED ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UINT is no Signed. + │ ^ Invalid type nature for generic argument. UINT is no ANY_SIGNED -error: Invalid type nature for generic argument. UDINT is no Signed. +error: Invalid type nature for generic argument. UDINT is no ANY_SIGNED ┌─ :5:59 │ 5 │ FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UDINT is no Signed. + │ ^ Invalid type nature for generic argument. UDINT is no ANY_SIGNED -error: Invalid type nature for generic argument. ULINT is no Signed. +error: Invalid type nature for generic argument. ULINT is no ANY_SIGNED ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. ULINT is no Signed. + │ ^ Invalid type nature for generic argument. ULINT is no ANY_SIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_multiple_parameters.snap index 59c8109954..ef01b27c8e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_multiple_parameters.snap @@ -2,29 +2,29 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Signed. +error: Invalid type nature for generic argument. REAL is no ANY_SIGNED ┌─ :15:14 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no Signed. + │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no ANY_SIGNED -error: Invalid type nature for generic argument. UDINT is no Signed. +error: Invalid type nature for generic argument. UDINT is no ANY_SIGNED ┌─ :15:24 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no Signed. + │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no ANY_SIGNED -error: Invalid type nature for generic argument. TIME is no Signed. +error: Invalid type nature for generic argument. TIME is no ANY_SIGNED ┌─ :15:50 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no Signed. + │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_SIGNED -error: Invalid type nature for generic argument. BYTE is no Signed. +error: Invalid type nature for generic argument. BYTE is no ANY_SIGNED ┌─ :15:60 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no Signed. + │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no ANY_SIGNED error: Invalid assignment: cannot assign 'STRING' to 'DINT' ┌─ :15:70 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'DINT' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^ Invalid assignment: cannot assign 'STRING' to 'DINT' -error: Invalid type nature for generic argument. STRING is no Signed. +error: Invalid type nature for generic argument. STRING is no ANY_SIGNED ┌─ :15:70 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^ Invalid type nature for generic argument. STRING is no Signed. + │ ^^^^^^^ Invalid type nature for generic argument. STRING is no ANY_SIGNED error: Invalid assignment: cannot assign 'CHAR' to 'DINT' ┌─ :15:79 @@ -44,16 +44,16 @@ error: Invalid assignment: cannot assign 'CHAR' to 'DINT' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'CHAR' to 'DINT' -error: Invalid type nature for generic argument. CHAR is no Signed. +error: Invalid type nature for generic argument. CHAR is no ANY_SIGNED ┌─ :15:79 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no Signed. + │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no ANY_SIGNED -error: Invalid type nature for generic argument. DATE is no Signed. +error: Invalid type nature for generic argument. DATE is no ANY_SIGNED ┌─ :15:89 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no Signed. + │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no ANY_SIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_bits.snap index a5fa4cc826..f02cb9d092 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_bits.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'BOOL' to 'STRING' 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'BOOL' to 'STRING' -error: Invalid type nature for generic argument. BOOL is no String. +error: Invalid type nature for generic argument. BOOL is no ANY_STRING ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BOOL is no String. + │ ^ Invalid type nature for generic argument. BOOL is no ANY_STRING error: Invalid assignment: cannot assign 'BYTE' to 'STRING' ┌─ :4:58 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'BYTE' to 'STRING' 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'BYTE' to 'STRING' -error: Invalid type nature for generic argument. BYTE is no String. +error: Invalid type nature for generic argument. BYTE is no ANY_STRING ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BYTE is no String. + │ ^ Invalid type nature for generic argument. BYTE is no ANY_STRING error: Invalid assignment: cannot assign 'WORD' to 'STRING' ┌─ :5:58 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'WORD' to 'STRING' 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WORD' to 'STRING' -error: Invalid type nature for generic argument. WORD is no String. +error: Invalid type nature for generic argument. WORD is no ANY_STRING ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WORD is no String. + │ ^ Invalid type nature for generic argument. WORD is no ANY_STRING error: Invalid assignment: cannot assign 'DWORD' to 'STRING' ┌─ :6:59 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'DWORD' to 'STRING' 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DWORD' to 'STRING' -error: Invalid type nature for generic argument. DWORD is no String. +error: Invalid type nature for generic argument. DWORD is no ANY_STRING ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DWORD is no String. + │ ^ Invalid type nature for generic argument. DWORD is no ANY_STRING error: Invalid assignment: cannot assign 'LWORD' to 'STRING' ┌─ :7:59 @@ -56,10 +56,10 @@ error: Invalid assignment: cannot assign 'LWORD' to 'STRING' 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'LWORD' to 'STRING' -error: Invalid type nature for generic argument. LWORD is no String. +error: Invalid type nature for generic argument. LWORD is no ANY_STRING ┌─ :7:59 │ 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LWORD is no String. + │ ^ Invalid type nature for generic argument. LWORD is no ANY_STRING diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_chars.snap index 9ea8bfc1de..c554f873b3 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_chars.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'CHAR' to 'STRING' 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'CHAR' to 'STRING' -error: Invalid type nature for generic argument. CHAR is no String. +error: Invalid type nature for generic argument. CHAR is no ANY_STRING ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. CHAR is no String. + │ ^ Invalid type nature for generic argument. CHAR is no ANY_STRING error: Invalid assignment: cannot assign 'WCHAR' to 'STRING' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WCHAR' to 'STRING' 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WCHAR' to 'STRING' -error: Invalid type nature for generic argument. WCHAR is no String. +error: Invalid type nature for generic argument. WCHAR is no ANY_STRING ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WCHAR is no String. + │ ^ Invalid type nature for generic argument. WCHAR is no ANY_STRING diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_date.snap index f9a298da7b..c5a9e23f19 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_date.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'DATE_AND_TIME' to 'STRING' 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DATE_AND_TIME' to 'STRING' -error: Invalid type nature for generic argument. DATE_AND_TIME is no String. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_STRING ┌─ :3:56 │ 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no String. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_STRING error: Invalid assignment: cannot assign 'DATE_AND_TIME' to 'STRING' ┌─ :4:57 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'DATE_AND_TIME' to 'STRING' 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DATE_AND_TIME' to 'STRING' -error: Invalid type nature for generic argument. DATE_AND_TIME is no String. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_STRING ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no String. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_STRING error: Invalid assignment: cannot assign 'DATE' to 'STRING' ┌─ :5:58 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'DATE' to 'STRING' 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DATE' to 'STRING' -error: Invalid type nature for generic argument. DATE is no String. +error: Invalid type nature for generic argument. DATE is no ANY_STRING ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE is no String. + │ ^ Invalid type nature for generic argument. DATE is no ANY_STRING error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING' ┌─ :6:57 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING' 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING' -error: Invalid type nature for generic argument. TIME_OF_DAY is no String. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_STRING ┌─ :6:57 │ 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no String. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_STRING error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING' ┌─ :7:58 @@ -56,10 +56,10 @@ error: Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING' 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING' -error: Invalid type nature for generic argument. TIME_OF_DAY is no String. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_STRING ┌─ :7:58 │ 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no String. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_STRING diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_ints.snap index 99cf46a912..a1b3699ca5 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_ints.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'USINT' to 'STRING' 4 │ FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'USINT' to 'STRING' -error: Invalid type nature for generic argument. USINT is no String. +error: Invalid type nature for generic argument. USINT is no ANY_STRING ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. USINT is no String. + │ ^ Invalid type nature for generic argument. USINT is no ANY_STRING error: Invalid assignment: cannot assign 'UINT' to 'STRING' ┌─ :5:58 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'UINT' to 'STRING' 5 │ FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'UINT' to 'STRING' -error: Invalid type nature for generic argument. UINT is no String. +error: Invalid type nature for generic argument. UINT is no ANY_STRING ┌─ :5:58 │ 5 │ FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UINT is no String. + │ ^ Invalid type nature for generic argument. UINT is no ANY_STRING error: Invalid assignment: cannot assign 'UDINT' to 'STRING' ┌─ :6:59 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'UDINT' to 'STRING' 6 │ FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'UDINT' to 'STRING' -error: Invalid type nature for generic argument. UDINT is no String. +error: Invalid type nature for generic argument. UDINT is no ANY_STRING ┌─ :6:59 │ 6 │ FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. UDINT is no String. + │ ^ Invalid type nature for generic argument. UDINT is no ANY_STRING error: Invalid assignment: cannot assign 'ULINT' to 'STRING' ┌─ :7:59 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'ULINT' to 'STRING' 7 │ FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'ULINT' to 'STRING' -error: Invalid type nature for generic argument. ULINT is no String. +error: Invalid type nature for generic argument. ULINT is no ANY_STRING ┌─ :7:59 │ 7 │ FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. ULINT is no String. + │ ^ Invalid type nature for generic argument. ULINT is no ANY_STRING error: Invalid assignment: cannot assign 'SINT' to 'STRING' ┌─ :9:58 @@ -56,11 +56,11 @@ error: Invalid assignment: cannot assign 'SINT' to 'STRING' 9 │ FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'SINT' to 'STRING' -error: Invalid type nature for generic argument. SINT is no String. +error: Invalid type nature for generic argument. SINT is no ANY_STRING ┌─ :9:58 │ 9 │ FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. SINT is no String. + │ ^ Invalid type nature for generic argument. SINT is no ANY_STRING error: Invalid assignment: cannot assign 'INT' to 'STRING' ┌─ :10:57 @@ -68,11 +68,11 @@ error: Invalid assignment: cannot assign 'INT' to 'STRING' 10 │ FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'INT' to 'STRING' -error: Invalid type nature for generic argument. INT is no String. +error: Invalid type nature for generic argument. INT is no ANY_STRING ┌─ :10:57 │ 10 │ FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. INT is no String. + │ ^ Invalid type nature for generic argument. INT is no ANY_STRING error: Invalid assignment: cannot assign 'DINT' to 'STRING' ┌─ :11:58 @@ -80,11 +80,11 @@ error: Invalid assignment: cannot assign 'DINT' to 'STRING' 11 │ FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'DINT' to 'STRING' -error: Invalid type nature for generic argument. DINT is no String. +error: Invalid type nature for generic argument. DINT is no ANY_STRING ┌─ :11:58 │ 11 │ FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DINT is no String. + │ ^ Invalid type nature for generic argument. DINT is no ANY_STRING error: Invalid assignment: cannot assign 'LINT' to 'STRING' ┌─ :12:58 @@ -92,10 +92,10 @@ error: Invalid assignment: cannot assign 'LINT' to 'STRING' 12 │ FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'LINT' to 'STRING' -error: Invalid type nature for generic argument. LINT is no String. +error: Invalid type nature for generic argument. LINT is no ANY_STRING ┌─ :12:58 │ 12 │ FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LINT is no String. + │ ^ Invalid type nature for generic argument. LINT is no ANY_STRING diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_reals.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_reals.snap index a6984ba6e8..7c6524d1e9 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_reals.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_reals.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'REAL' to 'STRING' 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'REAL' to 'STRING' -error: Invalid type nature for generic argument. REAL is no String. +error: Invalid type nature for generic argument. REAL is no ANY_STRING ┌─ :3:57 │ 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. REAL is no String. + │ ^ Invalid type nature for generic argument. REAL is no ANY_STRING error: Invalid assignment: cannot assign 'LREAL' to 'STRING' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'LREAL' to 'STRING' 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'LREAL' to 'STRING' -error: Invalid type nature for generic argument. LREAL is no String. +error: Invalid type nature for generic argument. LREAL is no ANY_STRING ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LREAL is no String. + │ ^ Invalid type nature for generic argument. LREAL is no ANY_STRING diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_time.snap index 1189636e09..4584777d73 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_time.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'TIME' to 'STRING' 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME' to 'STRING' -error: Invalid type nature for generic argument. TIME is no String. +error: Invalid type nature for generic argument. TIME is no ANY_STRING ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no String. + │ ^ Invalid type nature for generic argument. TIME is no ANY_STRING error: Invalid assignment: cannot assign 'TIME' to 'STRING' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'TIME' to 'STRING' 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'TIME' to 'STRING' -error: Invalid type nature for generic argument. TIME is no String. +error: Invalid type nature for generic argument. TIME is no ANY_STRING ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no String. + │ ^ Invalid type nature for generic argument. TIME is no ANY_STRING diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_multiple_parameters.snap index 7d29372c74..2234d436b0 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_multiple_parameters.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'REAL' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'REAL' to 'STRING' -error: Invalid type nature for generic argument. REAL is no String. +error: Invalid type nature for generic argument. REAL is no ANY_STRING ┌─ :15:14 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no String. + │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no ANY_STRING error: Invalid assignment: cannot assign 'UDINT' to 'STRING' ┌─ :15:24 @@ -20,11 +20,11 @@ error: Invalid assignment: cannot assign 'UDINT' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^^^^^ Invalid assignment: cannot assign 'UDINT' to 'STRING' -error: Invalid type nature for generic argument. UDINT is no String. +error: Invalid type nature for generic argument. UDINT is no ANY_STRING ┌─ :15:24 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no String. + │ ^^^^^^^^^^^^ Invalid type nature for generic argument. UDINT is no ANY_STRING error: Invalid assignment: cannot assign 'DINT' to 'STRING' ┌─ :15:38 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'DINT' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^^^ Invalid assignment: cannot assign 'DINT' to 'STRING' -error: Invalid type nature for generic argument. DINT is no String. +error: Invalid type nature for generic argument. DINT is no ANY_STRING ┌─ :15:38 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no String. + │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no ANY_STRING error: Invalid assignment: cannot assign 'TIME' to 'STRING' ┌─ :15:50 @@ -44,11 +44,11 @@ error: Invalid assignment: cannot assign 'TIME' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'TIME' to 'STRING' -error: Invalid type nature for generic argument. TIME is no String. +error: Invalid type nature for generic argument. TIME is no ANY_STRING ┌─ :15:50 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no String. + │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_STRING error: Invalid assignment: cannot assign 'BYTE' to 'STRING' ┌─ :15:60 @@ -56,11 +56,11 @@ error: Invalid assignment: cannot assign 'BYTE' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'BYTE' to 'STRING' -error: Invalid type nature for generic argument. BYTE is no String. +error: Invalid type nature for generic argument. BYTE is no ANY_STRING ┌─ :15:60 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no String. + │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no ANY_STRING error: Invalid assignment: cannot assign 'CHAR' to 'STRING' ┌─ :15:79 @@ -68,11 +68,11 @@ error: Invalid assignment: cannot assign 'CHAR' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'CHAR' to 'STRING' -error: Invalid type nature for generic argument. CHAR is no String. +error: Invalid type nature for generic argument. CHAR is no ANY_STRING ┌─ :15:79 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no String. + │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no ANY_STRING error: Invalid assignment: cannot assign 'DATE' to 'STRING' ┌─ :15:89 @@ -80,10 +80,10 @@ error: Invalid assignment: cannot assign 'DATE' to 'STRING' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'DATE' to 'STRING' -error: Invalid type nature for generic argument. DATE is no String. +error: Invalid type nature for generic argument. DATE is no ANY_STRING ┌─ :15:89 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no String. + │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no ANY_STRING diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_bits.snap index 5876d1cc1c..e8cd132fe9 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_bits.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. BOOL is no Unsigned. +error: Invalid type nature for generic argument. BOOL is no ANY_UNSIGNED ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BOOL is no Unsigned. + │ ^ Invalid type nature for generic argument. BOOL is no ANY_UNSIGNED -error: Invalid type nature for generic argument. BYTE is no Unsigned. +error: Invalid type nature for generic argument. BYTE is no ANY_UNSIGNED ┌─ :4:58 │ 4 │ FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. BYTE is no Unsigned. + │ ^ Invalid type nature for generic argument. BYTE is no ANY_UNSIGNED -error: Invalid type nature for generic argument. WORD is no Unsigned. +error: Invalid type nature for generic argument. WORD is no ANY_UNSIGNED ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WORD is no Unsigned. + │ ^ Invalid type nature for generic argument. WORD is no ANY_UNSIGNED -error: Invalid type nature for generic argument. DWORD is no Unsigned. +error: Invalid type nature for generic argument. DWORD is no ANY_UNSIGNED ┌─ :6:59 │ 6 │ FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DWORD is no Unsigned. + │ ^ Invalid type nature for generic argument. DWORD is no ANY_UNSIGNED -error: Invalid type nature for generic argument. LWORD is no Unsigned. +error: Invalid type nature for generic argument. LWORD is no ANY_UNSIGNED ┌─ :7:59 │ 7 │ FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LWORD is no Unsigned. + │ ^ Invalid type nature for generic argument. LWORD is no ANY_UNSIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_chars.snap index e281997f84..5cc838c45e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_chars.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'CHAR' to 'USINT' 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'CHAR' to 'USINT' -error: Invalid type nature for generic argument. CHAR is no Unsigned. +error: Invalid type nature for generic argument. CHAR is no ANY_UNSIGNED ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. CHAR is no Unsigned. + │ ^ Invalid type nature for generic argument. CHAR is no ANY_UNSIGNED error: Invalid assignment: cannot assign 'WCHAR' to 'USINT' ┌─ :4:59 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WCHAR' to 'USINT' 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WCHAR' to 'USINT' -error: Invalid type nature for generic argument. WCHAR is no Unsigned. +error: Invalid type nature for generic argument. WCHAR is no ANY_UNSIGNED ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WCHAR is no Unsigned. + │ ^ Invalid type nature for generic argument. WCHAR is no ANY_UNSIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_date.snap index d0abe53082..461517cfef 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_date.snap @@ -2,34 +2,34 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. DATE_AND_TIME is no Unsigned. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_UNSIGNED ┌─ :3:56 │ 3 │ FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Unsigned. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_UNSIGNED -error: Invalid type nature for generic argument. DATE_AND_TIME is no Unsigned. +error: Invalid type nature for generic argument. DATE_AND_TIME is no ANY_UNSIGNED ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no Unsigned. + │ ^ Invalid type nature for generic argument. DATE_AND_TIME is no ANY_UNSIGNED -error: Invalid type nature for generic argument. DATE is no Unsigned. +error: Invalid type nature for generic argument. DATE is no ANY_UNSIGNED ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DATE is no Unsigned. + │ ^ Invalid type nature for generic argument. DATE is no ANY_UNSIGNED -error: Invalid type nature for generic argument. TIME_OF_DAY is no Unsigned. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_UNSIGNED ┌─ :6:57 │ 6 │ FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Unsigned. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_UNSIGNED -error: Invalid type nature for generic argument. TIME_OF_DAY is no Unsigned. +error: Invalid type nature for generic argument. TIME_OF_DAY is no ANY_UNSIGNED ┌─ :7:58 │ 7 │ FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no Unsigned. + │ ^ Invalid type nature for generic argument. TIME_OF_DAY is no ANY_UNSIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_reals.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_reals.snap index 3bcba293c9..796c0150ee 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_reals.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_reals.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Unsigned. +error: Invalid type nature for generic argument. REAL is no ANY_UNSIGNED ┌─ :3:57 │ 3 │ FUNCTION func : INT VAR x : REAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. REAL is no Unsigned. + │ ^ Invalid type nature for generic argument. REAL is no ANY_UNSIGNED -error: Invalid type nature for generic argument. LREAL is no Unsigned. +error: Invalid type nature for generic argument. LREAL is no ANY_UNSIGNED ┌─ :4:59 │ 4 │ FUNCTION func1 : INT VAR x : LREAL; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LREAL is no Unsigned. + │ ^ Invalid type nature for generic argument. LREAL is no ANY_UNSIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_signed_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_signed_ints.snap index 36b40f22db..268af3b691 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_signed_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_signed_ints.snap @@ -2,28 +2,28 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. SINT is no Unsigned. +error: Invalid type nature for generic argument. SINT is no ANY_UNSIGNED ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. SINT is no Unsigned. + │ ^ Invalid type nature for generic argument. SINT is no ANY_UNSIGNED -error: Invalid type nature for generic argument. INT is no Unsigned. +error: Invalid type nature for generic argument. INT is no ANY_UNSIGNED ┌─ :4:57 │ 4 │ FUNCTION func2 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. INT is no Unsigned. + │ ^ Invalid type nature for generic argument. INT is no ANY_UNSIGNED -error: Invalid type nature for generic argument. DINT is no Unsigned. +error: Invalid type nature for generic argument. DINT is no ANY_UNSIGNED ┌─ :5:58 │ 5 │ FUNCTION func3 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. DINT is no Unsigned. + │ ^ Invalid type nature for generic argument. DINT is no ANY_UNSIGNED -error: Invalid type nature for generic argument. LINT is no Unsigned. +error: Invalid type nature for generic argument. LINT is no ANY_UNSIGNED ┌─ :6:58 │ 6 │ FUNCTION func4 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. LINT is no Unsigned. + │ ^ Invalid type nature for generic argument. LINT is no ANY_UNSIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_string.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_string.snap index c1bc15b379..6a93df97d7 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_string.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_string.snap @@ -8,11 +8,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'USINT' 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'STRING' to 'USINT' -error: Invalid type nature for generic argument. STRING is no Unsigned. +error: Invalid type nature for generic argument. STRING is no ANY_UNSIGNED ┌─ :3:61 │ 3 │ FUNCTION func1 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. STRING is no Unsigned. + │ ^ Invalid type nature for generic argument. STRING is no ANY_UNSIGNED error: Invalid assignment: cannot assign 'WSTRING' to 'USINT' ┌─ :4:61 @@ -20,10 +20,10 @@ error: Invalid assignment: cannot assign 'WSTRING' to 'USINT' 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION │ ^ Invalid assignment: cannot assign 'WSTRING' to 'USINT' -error: Invalid type nature for generic argument. WSTRING is no Unsigned. +error: Invalid type nature for generic argument. WSTRING is no ANY_UNSIGNED ┌─ :4:61 │ 4 │ FUNCTION func2 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. WSTRING is no Unsigned. + │ ^ Invalid type nature for generic argument. WSTRING is no ANY_UNSIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_time.snap index f47254d309..f026ed39ad 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_time.snap @@ -2,16 +2,16 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. TIME is no Unsigned. +error: Invalid type nature for generic argument. TIME is no ANY_UNSIGNED ┌─ :3:58 │ 3 │ FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Unsigned. + │ ^ Invalid type nature for generic argument. TIME is no ANY_UNSIGNED -error: Invalid type nature for generic argument. TIME is no Unsigned. +error: Invalid type nature for generic argument. TIME is no ANY_UNSIGNED ┌─ :4:59 │ 4 │ FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION - │ ^ Invalid type nature for generic argument. TIME is no Unsigned. + │ ^ Invalid type nature for generic argument. TIME is no ANY_UNSIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_multiple_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_multiple_parameters.snap index 5b64fff636..604d52d57e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_multiple_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_multiple_parameters.snap @@ -2,29 +2,29 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Invalid type nature for generic argument. REAL is no Unsigned. +error: Invalid type nature for generic argument. REAL is no ANY_UNSIGNED ┌─ :15:14 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no Unsigned. + │ ^^^^^^^^ Invalid type nature for generic argument. REAL is no ANY_UNSIGNED -error: Invalid type nature for generic argument. DINT is no Unsigned. +error: Invalid type nature for generic argument. DINT is no ANY_UNSIGNED ┌─ :15:38 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no Unsigned. + │ ^^^^^^^^^^ Invalid type nature for generic argument. DINT is no ANY_UNSIGNED -error: Invalid type nature for generic argument. TIME is no Unsigned. +error: Invalid type nature for generic argument. TIME is no ANY_UNSIGNED ┌─ :15:50 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no Unsigned. + │ ^^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_UNSIGNED -error: Invalid type nature for generic argument. BYTE is no Unsigned. +error: Invalid type nature for generic argument. BYTE is no ANY_UNSIGNED ┌─ :15:60 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no Unsigned. + │ ^^^^^^^^ Invalid type nature for generic argument. BYTE is no ANY_UNSIGNED error: Invalid assignment: cannot assign 'STRING' to 'UDINT' ┌─ :15:70 @@ -32,11 +32,11 @@ error: Invalid assignment: cannot assign 'STRING' to 'UDINT' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^ Invalid assignment: cannot assign 'STRING' to 'UDINT' -error: Invalid type nature for generic argument. STRING is no Unsigned. +error: Invalid type nature for generic argument. STRING is no ANY_UNSIGNED ┌─ :15:70 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^ Invalid type nature for generic argument. STRING is no Unsigned. + │ ^^^^^^^ Invalid type nature for generic argument. STRING is no ANY_UNSIGNED error: Invalid assignment: cannot assign 'CHAR' to 'UDINT' ┌─ :15:79 @@ -44,16 +44,16 @@ error: Invalid assignment: cannot assign 'CHAR' to 'UDINT' 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); │ ^^^^^^^^ Invalid assignment: cannot assign 'CHAR' to 'UDINT' -error: Invalid type nature for generic argument. CHAR is no Unsigned. +error: Invalid type nature for generic argument. CHAR is no ANY_UNSIGNED ┌─ :15:79 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no Unsigned. + │ ^^^^^^^^ Invalid type nature for generic argument. CHAR is no ANY_UNSIGNED -error: Invalid type nature for generic argument. DATE is no Unsigned. +error: Invalid type nature for generic argument. DATE is no ANY_UNSIGNED ┌─ :15:89 │ 15 │ func(var_real, var_unsigned, var_signed, var_time, var_byte, var_str, var_char, var_date); - │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no Unsigned. + │ ^^^^^^^^ Invalid type nature for generic argument. DATE is no ANY_UNSIGNED diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__non_resolved_generics_reported.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__non_resolved_generics_reported.snap index 24ac4b53e5..be976fc5e8 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__non_resolved_generics_reported.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__non_resolved_generics_reported.snap @@ -2,10 +2,10 @@ source: src/validation/tests/generic_validation_tests.rs expression: "&diagnostics" --- -error: Could not resolve generic type T with nature String +error: Could not resolve generic type T with ANY_STRING ┌─ :3:31 │ 3 │ FUNCTION func : INT test(); END_FUNCTION - │ ^^^^^^^ Could not resolve generic type T with nature String + │ ^^^^^^^ Could not resolve generic type T with ANY_STRING diff --git a/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__literal_cast_with_non_literal.snap b/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__literal_cast_with_non_literal.snap index e731ba3200..163a44716d 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__literal_cast_with_non_literal.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__literal_cast_with_non_literal.snap @@ -2,10 +2,10 @@ source: src/validation/tests/literals_validation_tests.rs expression: "&diagnostics" --- -error: Expected literal +error: Cannot cast into [x], only elementary types are allowed ┌─ :2:13 │ 2 │ INT#[x]; - │ ^^^^^^^ Expected literal + │ ^^^^^^^ Cannot cast into [x], only elementary types are allowed diff --git a/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__function_has_super_class.snap b/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__function_has_super_class.snap index 29e436404b..990c7b1212 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__function_has_super_class.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__function_has_super_class.snap @@ -2,11 +2,11 @@ source: src/validation/tests/pou_validation_tests.rs expression: "&diagnostics" --- -error: A function cannot use EXTEND +error: A function cannot use `EXTEND` ┌─ :5:18 │ 5 │ FUNCTION func EXTENDS cls - │ ^^^^ A function cannot use EXTEND + │ ^^^^ A function cannot use `EXTEND` error: Function Return type missing ┌─ :5:18 diff --git a/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__program_has_super_class.snap b/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__program_has_super_class.snap index 2ed1b32923..4e788c9e72 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__program_has_super_class.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__program_has_super_class.snap @@ -2,10 +2,10 @@ source: src/validation/tests/pou_validation_tests.rs expression: "&diagnostics" --- -error: A program cannot use EXTEND +error: A program cannot use `EXTEND` ┌─ :5:17 │ 5 │ PROGRAM prog EXTENDS cls - │ ^^^^ A program cannot use EXTEND + │ ^^^^ A program cannot use `EXTEND` diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_aba_input.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_aba_input.snap index 8cc8e82837..e65c40c93e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_aba_input.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_aba_input.snap @@ -6,7 +6,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:18 │ 2 │ TYPE A : STRUCT - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 6 │ FUNCTION_BLOCK B │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_aba_output.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_aba_output.snap index 8cc8e82837..e65c40c93e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_aba_output.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_aba_output.snap @@ -6,7 +6,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:18 │ 2 │ TYPE A : STRUCT - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 6 │ FUNCTION_BLOCK B │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_bcb.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_bcb.snap index fa8fe2a89b..d80864dd59 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_bcb.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_bcb.snap @@ -6,7 +6,10 @@ error: Recursive data structure `B -> C -> B` has infinite size ┌─ :6:18 │ 6 │ TYPE B : STRUCT - │ ^ Recursive data structure `B -> C -> B` has infinite size + │ ^ + │ │ + │ Recursive data structure `B -> C -> B` has infinite size + │ see also · 10 │ TYPE C : STRUCT │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_with_multiple_identical_members_aba.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_with_multiple_identical_members_aba.snap index 09cc059a87..a9af318934 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_with_multiple_identical_members_aba.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_with_multiple_identical_members_aba.snap @@ -6,7 +6,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:18 │ 2 │ TYPE A : STRUCT - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 8 │ TYPE B : STRUCT │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_aa_and_aba.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_aa_and_aba.snap index 27960e1961..cae82b9ec4 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_aa_and_aba.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_aa_and_aba.snap @@ -12,7 +12,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:18 │ 2 │ TYPE A : STRUCT - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 7 │ TYPE B : STRUCT │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_with_branch_input.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_with_branch_input.snap index 9b1d70c775..188fd2d59b 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_with_branch_input.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_with_branch_input.snap @@ -6,7 +6,10 @@ error: Recursive data structure `F -> G -> H -> I -> F` has infinite size ┌─ :22:28 │ 22 │ FUNCTION_BLOCK F - │ ^ Recursive data structure `F -> G -> H -> I -> F` has infinite size + │ ^ + │ │ + │ Recursive data structure `F -> G -> H -> I -> F` has infinite size + │ see also · 29 │ TYPE G : STRUCT │ - see also @@ -21,7 +24,10 @@ error: Recursive data structure `B -> C -> E -> F -> B` has infinite size ┌─ :8:18 │ 8 │ TYPE B : STRUCT - │ ^ Recursive data structure `B -> C -> E -> F -> B` has infinite size + │ ^ + │ │ + │ Recursive data structure `B -> C -> E -> F -> B` has infinite size + │ see also · 12 │ FUNCTION_BLOCK C │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_input.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_input.snap index 92e6b08c0d..c11483cfe0 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_input.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_input.snap @@ -6,7 +6,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:28 │ 2 │ FUNCTION_BLOCK A - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 9 │ FUNCTION_BLOCK B │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_output.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_output.snap index 92e6b08c0d..c11483cfe0 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_output.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_output.snap @@ -6,7 +6,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:28 │ 2 │ FUNCTION_BLOCK A - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 9 │ FUNCTION_BLOCK B │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_var.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_var.snap index 92e6b08c0d..c11483cfe0 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_var.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__one_cycle_aba_var.snap @@ -6,7 +6,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:28 │ 2 │ FUNCTION_BLOCK A - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 9 │ FUNCTION_BLOCK B │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__two_cycles_with_branch_input.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__two_cycles_with_branch_input.snap index 3d405ada9e..77ef800d3b 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__two_cycles_with_branch_input.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__two_cycles_with_branch_input.snap @@ -6,7 +6,10 @@ error: Recursive data structure `F -> G -> H -> I -> F` has infinite size ┌─ :26:28 │ 26 │ FUNCTION_BLOCK F - │ ^ Recursive data structure `F -> G -> H -> I -> F` has infinite size + │ ^ + │ │ + │ Recursive data structure `F -> G -> H -> I -> F` has infinite size + │ see also · 33 │ FUNCTION_BLOCK G │ - see also @@ -21,7 +24,10 @@ error: Recursive data structure `B -> C -> E -> F -> B` has infinite size ┌─ :8:28 │ 8 │ FUNCTION_BLOCK B - │ ^ Recursive data structure `B -> C -> E -> F -> B` has infinite size + │ ^ + │ │ + │ Recursive data structure `B -> C -> E -> F -> B` has infinite size + │ see also · 14 │ FUNCTION_BLOCK C │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__one_cycle_aba_input.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__one_cycle_aba_input.snap index 8cc8e82837..e65c40c93e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__one_cycle_aba_input.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__one_cycle_aba_input.snap @@ -6,7 +6,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:18 │ 2 │ TYPE A : STRUCT - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 6 │ FUNCTION_BLOCK B │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__one_cycle_aba_output.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__one_cycle_aba_output.snap index 8cc8e82837..e65c40c93e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__one_cycle_aba_output.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__one_cycle_aba_output.snap @@ -6,7 +6,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:18 │ 2 │ TYPE A : STRUCT - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 6 │ FUNCTION_BLOCK B │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__two_cycles_with_branch_input.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__two_cycles_with_branch_input.snap index 9b1d70c775..188fd2d59b 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__two_cycles_with_branch_input.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__two_cycles_with_branch_input.snap @@ -6,7 +6,10 @@ error: Recursive data structure `F -> G -> H -> I -> F` has infinite size ┌─ :22:28 │ 22 │ FUNCTION_BLOCK F - │ ^ Recursive data structure `F -> G -> H -> I -> F` has infinite size + │ ^ + │ │ + │ Recursive data structure `F -> G -> H -> I -> F` has infinite size + │ see also · 29 │ TYPE G : STRUCT │ - see also @@ -21,7 +24,10 @@ error: Recursive data structure `B -> C -> E -> F -> B` has infinite size ┌─ :8:18 │ 8 │ TYPE B : STRUCT - │ ^ Recursive data structure `B -> C -> E -> F -> B` has infinite size + │ ^ + │ │ + │ Recursive data structure `B -> C -> E -> F -> B` has infinite size + │ see also · 12 │ FUNCTION_BLOCK C │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_aba.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_aba.snap index e51c1a8270..2029f87e3c 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_aba.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_aba.snap @@ -6,7 +6,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:18 │ 2 │ TYPE A : STRUCT - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 6 │ TYPE B : STRUCT │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_abca.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_abca.snap index f76b47c047..28bdb83df1 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_abca.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_abca.snap @@ -6,7 +6,10 @@ error: Recursive data structure `A -> B -> C -> A` has infinite size ┌─ :2:18 │ 2 │ TYPE A : STRUCT - │ ^ Recursive data structure `A -> B -> C -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> C -> A` has infinite size + │ see also · 6 │ TYPE B : STRUCT │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_bcb.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_bcb.snap index fa8fe2a89b..d80864dd59 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_bcb.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_bcb.snap @@ -6,7 +6,10 @@ error: Recursive data structure `B -> C -> B` has infinite size ┌─ :6:18 │ 6 │ TYPE B : STRUCT - │ ^ Recursive data structure `B -> C -> B` has infinite size + │ ^ + │ │ + │ Recursive data structure `B -> C -> B` has infinite size + │ see also · 10 │ TYPE C : STRUCT │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_with_multiple_identical_members_aba.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_with_multiple_identical_members_aba.snap index 09cc059a87..a9af318934 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_with_multiple_identical_members_aba.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_with_multiple_identical_members_aba.snap @@ -6,7 +6,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:18 │ 2 │ TYPE A : STRUCT - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 8 │ TYPE B : STRUCT │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_aa_and_aba.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_aa_and_aba.snap index 27960e1961..cae82b9ec4 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_aa_and_aba.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_aa_and_aba.snap @@ -12,7 +12,10 @@ error: Recursive data structure `A -> B -> A` has infinite size ┌─ :2:18 │ 2 │ TYPE A : STRUCT - │ ^ Recursive data structure `A -> B -> A` has infinite size + │ ^ + │ │ + │ Recursive data structure `A -> B -> A` has infinite size + │ see also · 7 │ TYPE B : STRUCT │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_branch_cc_and_cec.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_branch_cc_and_cec.snap index 7df694da3b..5ed2bb31de 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_branch_cc_and_cec.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_branch_cc_and_cec.snap @@ -12,7 +12,10 @@ error: Recursive data structure `C -> E -> C` has infinite size ┌─ :10:18 │ 10 │ TYPE C : STRUCT - │ ^ Recursive data structure `C -> E -> C` has infinite size + │ ^ + │ │ + │ Recursive data structure `C -> E -> C` has infinite size + │ see also · 15 │ TYPE E : STRUCT │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_with_branch.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_with_branch.snap index b91f2d2f8e..7ff9e5a350 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_with_branch.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_with_branch.snap @@ -6,7 +6,10 @@ error: Recursive data structure `F -> G -> H -> I -> F` has infinite size ┌─ :18:18 │ 18 │ TYPE F : STRUCT - │ ^ Recursive data structure `F -> G -> H -> I -> F` has infinite size + │ ^ + │ │ + │ Recursive data structure `F -> G -> H -> I -> F` has infinite size + │ see also · 23 │ TYPE G : STRUCT │ - see also @@ -21,7 +24,10 @@ error: Recursive data structure `B -> C -> E -> F -> B` has infinite size ┌─ :6:18 │ 6 │ TYPE B : STRUCT - │ ^ Recursive data structure `B -> C -> E -> F -> B` has infinite size + │ ^ + │ │ + │ Recursive data structure `B -> C -> E -> F -> B` has infinite size + │ see also · 10 │ TYPE C : STRUCT │ - see also diff --git a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_calls_and_parameters.snap b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_calls_and_parameters.snap index 98d0bc9eb2..06234fa74d 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_calls_and_parameters.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_calls_and_parameters.snap @@ -20,6 +20,12 @@ error: Could not resolve reference to c 7 │ foo(x := c); │ ^ Could not resolve reference to c +error: Invalid call parameters + ┌─ :8:21 + │ +8 │ foo(y := a); + │ ^^^^^^ Invalid call parameters + error: Could not resolve reference to y ┌─ :8:21 │ diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_too_small_type_to_pointer_result_in_an_error.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_too_small_type_to_pointer_result_in_an_error.snap index f26f8d7f18..aacd24486f 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_too_small_type_to_pointer_result_in_an_error.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_too_small_type_to_pointer_result_in_an_error.snap @@ -2,11 +2,11 @@ source: src/validation/tests/statement_validation_tests.rs expression: "&diagnostics" --- -error: The type DWORD 32 is too small to to be stored in a Pointer +error: The type DWORD 32 is too small to be stored in a Pointer ┌─ :9:13 │ 9 │ ptr := address; //should throw error as address is too small to store full pointer - │ ^^^^^^^^^^^^^^ The type DWORD 32 is too small to to be stored in a Pointer + │ ^^^^^^^^^^^^^^ The type DWORD 32 is too small to be stored in a Pointer error: Invalid assignment: cannot assign 'DWORD' to 'REF_TO INT' ┌─ :9:13 diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assigning_to_rvalue.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assigning_to_rvalue.snap index 142d61482d..1d1e0ce530 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assigning_to_rvalue.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assigning_to_rvalue.snap @@ -2,22 +2,28 @@ source: src/validation/tests/statement_validation_tests.rs expression: "&diagnostics" --- -error: Expression is not assignable +error: Expression 1 is not assignable. ┌─ :12:13 │ 12 │ 1 := 1; - │ ^ Expression is not assignable + │ ^ Expression 1 is not assignable. -error: Expression is not assignable +error: Expression 1 is not assignable. ┌─ :13:13 │ 13 │ 1 := i; - │ ^ Expression is not assignable + │ ^ Expression 1 is not assignable. + +error: Invalid call parameters + ┌─ :14:18 + │ +14 │ func(1 := 1); + │ ^^^^^^ Invalid call parameters error: Expression is not assignable ┌─ :14:18 │ 14 │ func(1 := 1); - │ ^ Expression is not assignable + │ ^^^^^^ Expression is not assignable diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__bit_access_with_incorrect_operator_causes_warning.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__bit_access_with_incorrect_operator_causes_warning.snap index a5a87489cc..65699a7a66 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__bit_access_with_incorrect_operator_causes_warning.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__bit_access_with_incorrect_operator_causes_warning.snap @@ -8,10 +8,10 @@ error: Could not resolve reference to n1 12 │ Output.var1.n1 := Input.var1; // bitaccess without %X -> Warning │ ^^ Could not resolve reference to n1 -warning: If you meant to directly access a bit/byte/word/.., use %X/%B/%Wn1 instead. +note: If you meant to directly access a bit/byte/word/..., use %X/%B/%Wn1 instead. ┌─ :12:25 │ 12 │ Output.var1.n1 := Input.var1; // bitaccess without %X -> Warning - │ ^^ If you meant to directly access a bit/byte/word/.., use %X/%B/%Wn1 instead. + │ ^^ If you meant to directly access a bit/byte/word/..., use %X/%B/%Wn1 instead. diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__exlicit_param_different_casing.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__exlicit_param_different_casing.snap new file mode 100644 index 0000000000..e123c05d92 --- /dev/null +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__exlicit_param_different_casing.snap @@ -0,0 +1,5 @@ +--- +source: src/validation/tests/statement_validation_tests.rs +expression: diagnostics +--- + diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__exlicit_param_unknown_reference.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__exlicit_param_unknown_reference.snap new file mode 100644 index 0000000000..83ec266b63 --- /dev/null +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__exlicit_param_unknown_reference.snap @@ -0,0 +1,17 @@ +--- +source: src/validation/tests/statement_validation_tests.rs +expression: diagnostics +--- +error: Invalid call parameters + ┌─ :13:16 + │ +13 │ fb(unknown := 2); + │ ^^^^^^^^^^^^ Invalid call parameters + +error: Could not resolve reference to unknown + ┌─ :13:16 + │ +13 │ fb(unknown := 2); + │ ^^^^^^^ Could not resolve reference to unknown + + diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__reference_to_reference_assignments_in_function_arguments.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__reference_to_reference_assignments_in_function_arguments.snap index 02f721f482..2140ecb219 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__reference_to_reference_assignments_in_function_arguments.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__reference_to_reference_assignments_in_function_arguments.snap @@ -2,40 +2,40 @@ source: src/validation/tests/statement_validation_tests.rs expression: "&diagnostics" --- -error: Invalid assignment: cannot assign '__POINTER_TO_INT' to 'REF_TO STRUCT_params' +warning: Pointers REF_TO STRUCT_params and __POINTER_TO_INT have different types ┌─ :47:13 │ 47 │ input1 := REF(global4), - │ ^^^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_INT' to 'REF_TO STRUCT_params' + │ ^^^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT_params and __POINTER_TO_INT have different types -error: Invalid assignment: cannot assign '__POINTER_TO_REAL' to 'REF_TO STRUCT_params' +warning: Pointers REF_TO STRUCT_params and __POINTER_TO_REAL have different types ┌─ :48:13 │ 48 │ input2 := REF(global5), - │ ^^^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_REAL' to 'REF_TO STRUCT_params' + │ ^^^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT_params and __POINTER_TO_REAL have different types -error: Invalid assignment: cannot assign '__POINTER_TO_STRING' to 'REF_TO STRUCT_params' +warning: Pointers REF_TO STRUCT_params and __POINTER_TO_STRING have different types ┌─ :49:13 │ 49 │ input3 := REF(global6), - │ ^^^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_STRING' to 'REF_TO STRUCT_params' + │ ^^^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT_params and __POINTER_TO_STRING have different types -error: Invalid assignment: cannot assign '__POINTER_TO_INT' to 'REF_TO STRUCT_params' +warning: Pointers REF_TO STRUCT_params and __POINTER_TO_INT have different types ┌─ :55:13 │ 55 │ input1 := &(global4), - │ ^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_INT' to 'REF_TO STRUCT_params' + │ ^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT_params and __POINTER_TO_INT have different types -error: Invalid assignment: cannot assign '__POINTER_TO_REAL' to 'REF_TO STRUCT_params' +warning: Pointers REF_TO STRUCT_params and __POINTER_TO_REAL have different types ┌─ :56:13 │ 56 │ input2 := &(global5), - │ ^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO_REAL' to 'REF_TO STRUCT_params' + │ ^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT_params and __POINTER_TO_REAL have different types -error: Invalid assignment: cannot assign '__POINTER_TO___global_global6' to 'REF_TO STRUCT_params' +warning: Pointers REF_TO STRUCT_params and __POINTER_TO___global_global6 have different types ┌─ :57:13 │ 57 │ input3 := &(global6), - │ ^^^^^^^^^^^^^^^^^^^^ Invalid assignment: cannot assign '__POINTER_TO___global_global6' to 'REF_TO STRUCT_params' + │ ^^^^^^^^^^^^^^^^^^^^ Pointers REF_TO STRUCT_params and __POINTER_TO___global_global6 have different types diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer_non_const_var_reference.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer_non_const_var_reference.snap index 8df7a6e3df..31a2d2b32f 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer_non_const_var_reference.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer_non_const_var_reference.snap @@ -2,28 +2,28 @@ source: src/validation/tests/statement_validation_tests.rs expression: "&diagnostics" --- -error: 'x' is no const reference. Non constant variables are not supported in case conditions +error: `x` is no const reference. Non constant variables are not supported in case conditions ┌─ :14:17 │ 14 │ x: // x is no constant => error - │ ^ 'x' is no const reference. Non constant variables are not supported in case conditions + │ ^ `x` is no const reference. Non constant variables are not supported in case conditions -error: 'y' is no const reference. Non constant variables are not supported in case conditions +error: `y` is no const reference. Non constant variables are not supported in case conditions ┌─ :16:17 │ 16 │ y: // y is no constant => error - │ ^ 'y' is no const reference. Non constant variables are not supported in case conditions + │ ^ `y` is no const reference. Non constant variables are not supported in case conditions -error: 'x' is no const reference. Non constant variables are not supported in case conditions +error: `x` is no const reference. Non constant variables are not supported in case conditions ┌─ :18:17 │ 18 │ 2+x: // x is no constant => error - │ ^^^ 'x' is no const reference. Non constant variables are not supported in case conditions + │ ^^^ `x` is no const reference. Non constant variables are not supported in case conditions -error: 'x' is no const reference. Non constant variables are not supported in case conditions +error: `x` is no const reference. Non constant variables are not supported in case conditions ┌─ :22:17 │ 22 │ CONST+x: // x is no constant => error - │ ^^^^^^^ 'x' is no const reference. Non constant variables are not supported in case conditions + │ ^^^^^^^ `x` is no const reference. Non constant variables are not supported in case conditions diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_length_array_test__builtins__builtins_called_with_invalid_index.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_length_array_test__builtins__builtins_called_with_invalid_index.snap index 612d36a31c..27f71a652d 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_length_array_test__builtins__builtins_called_with_invalid_index.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_length_array_test__builtins__builtins_called_with_invalid_index.snap @@ -2,40 +2,40 @@ source: src/validation/tests/variable_length_array_test.rs expression: diagnostics --- -error: Invalid type nature for generic argument. REAL is no Int. +error: Invalid type nature for generic argument. REAL is no ANY_INT ┌─ :18:30 │ 18 │ LOWER_BOUND(vla, 3.1415); // invalid - │ ^^^^^^ Invalid type nature for generic argument. REAL is no Int. + │ ^^^^^^ Invalid type nature for generic argument. REAL is no ANY_INT -error: Invalid type nature for generic argument. TIME is no Int. +error: Invalid type nature for generic argument. TIME is no ANY_INT ┌─ :19:30 │ 19 │ LOWER_BOUND(vla, TIME#3s); // invalid - │ ^^^^^^^ Invalid type nature for generic argument. TIME is no Int. + │ ^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_INT -error: Index out of bounds. +error: Index out of bound ┌─ :20:13 │ 20 │ LOWER_BOUND(vla, 0); // index out of bounds - │ ^^^^^^^^^^^ Index out of bounds. + │ ^^^^^^^^^^^ Index out of bound -error: Invalid type nature for generic argument. REAL is no Int. +error: Invalid type nature for generic argument. REAL is no ANY_INT ┌─ :22:30 │ 22 │ UPPER_BOUND(vla, 3.1415); // invalid - │ ^^^^^^ Invalid type nature for generic argument. REAL is no Int. + │ ^^^^^^ Invalid type nature for generic argument. REAL is no ANY_INT -error: Invalid type nature for generic argument. TIME is no Int. +error: Invalid type nature for generic argument. TIME is no ANY_INT ┌─ :23:30 │ 23 │ UPPER_BOUND(vla, TIME#3s); // invalid - │ ^^^^^^^ Invalid type nature for generic argument. TIME is no Int. + │ ^^^^^^^ Invalid type nature for generic argument. TIME is no ANY_INT -error: Index out of bounds. +error: Index out of bound ┌─ :24:13 │ 24 │ UPPER_BOUND(vla, 0); // index out of bounds - │ ^^^^^^^^^^^ Index out of bounds. + │ ^^^^^^^^^^^ Index out of bound diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_aliases.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_aliases.snap index ff7e700c1a..97d2183a99 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_aliases.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_aliases.snap @@ -2,19 +2,19 @@ source: src/validation/tests/variable_validation_tests.rs expression: diagnostics --- -error: This will overflow for type INT +warning: This will overflow for type INT ┌─ :2:36 │ 2 │ TYPE MyINT : INT := 60000; END_TYPE │ ^^^^^ This will overflow for type INT -error: This will overflow for type REAL +warning: This will overflow for type REAL ┌─ :3:36 │ 3 │ TYPE MyREAL : REAL := 3.50282347E+38; END_TYPE │ ^^^^^^^^^^^^^^ This will overflow for type REAL -error: This will overflow for type LREAL +warning: This will overflow for type LREAL ┌─ :4:36 │ 4 │ TYPE MyLREAL : LREAL := 1.8076931348623157E+308; END_TYPE diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_array_initializer.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_array_initializer.snap index c8bf4d92c2..dfe9777605 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_array_initializer.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_array_initializer.snap @@ -2,7 +2,7 @@ source: src/validation/tests/variable_validation_tests.rs expression: diagnostics --- -error: This will overflow for type UINT +warning: This will overflow for type UINT ┌─ :3:46 │ 3 │ arr : ARRAY[0..5] OF UINT := [0, -1, -2, -3, -4, -5]; diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_constants.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_constants.snap index 5bf1340851..3606e01936 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_constants.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_constants.snap @@ -2,7 +2,7 @@ source: src/validation/tests/variable_validation_tests.rs expression: diagnostics --- -error: This will overflow for type INT +warning: This will overflow for type INT ┌─ :3:24 │ 3 │ a : INT := 16384; // OK diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_expressions.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_expressions.snap index 1e07e18ae3..526736e278 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_expressions.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_expressions.snap @@ -2,121 +2,121 @@ source: src/validation/tests/variable_validation_tests.rs expression: diagnostics --- -error: This will overflow for type SINT +warning: This will overflow for type SINT ┌─ :5:42 │ 5 │ min_sint : SINT := ((-128 * 1) * 2); // -128 │ ^^^^^^^^^^^^^ This will overflow for type SINT -error: This will overflow for type SINT +warning: This will overflow for type SINT ┌─ :6:43 │ 6 │ max_sint : SINT := ((127 * 1) * 2); // 127 │ ^^^^^^^^^^^^ This will overflow for type SINT -error: This will overflow for type USINT +warning: This will overflow for type USINT ┌─ :7:43 │ 7 │ min_usint : USINT := ((1 * 1) * -2); // 0 │ ^^^^^^^^^^^ This will overflow for type USINT -error: This will overflow for type USINT +warning: This will overflow for type USINT ┌─ :8:43 │ 8 │ max_usint : USINT := ((256 * 1) * 2); // 256 │ ^^^^^^^^^^^^ This will overflow for type USINT -error: This will overflow for type INT +warning: This will overflow for type INT ┌─ :11:41 │ 11 │ min_int : INT := ((-32_768 * 1) * 2); // -32768 │ ^^^^^^^^^^^^^^^^ This will overflow for type INT -error: This will overflow for type INT +warning: This will overflow for type INT ┌─ :12:42 │ 12 │ max_int : INT := ((32_767 * 1) * 2); // 32767 │ ^^^^^^^^^^^^^^^ This will overflow for type INT -error: This will overflow for type UINT +warning: This will overflow for type UINT ┌─ :13:42 │ 13 │ min_uint : UINT := ((1 * 1) * -2); // 0 │ ^^^^^^^^^^^ This will overflow for type UINT -error: This will overflow for type UINT +warning: This will overflow for type UINT ┌─ :14:42 │ 14 │ max_uint : UINT := ((65_536 * 1) * 2); // 65536 │ ^^^^^^^^^^^^^^^ This will overflow for type UINT -error: This will overflow for type DINT +warning: This will overflow for type DINT ┌─ :17:42 │ 17 │ min_dint : DINT := ((-2_147_483_649 * 1) * 2); // -2_147_483_648 │ ^^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type DINT -error: This will overflow for type DINT +warning: This will overflow for type DINT ┌─ :18:43 │ 18 │ max_dint : DINT := (( 2_147_483_648 * 1) * 2); // 2_147_483_647 │ ^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type DINT -error: This will overflow for type UDINT +warning: This will overflow for type UDINT ┌─ :19:43 │ 19 │ min_udint : UDINT := ((1 * 1) * -2); // 0 │ ^^^^^^^^^^^ This will overflow for type UDINT -error: This will overflow for type UDINT +warning: This will overflow for type UDINT ┌─ :20:43 │ 20 │ max_udint : UDINT := ((4_294_967_296 * 1) * 2); // 4_294_967_296 │ ^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type UDINT -error: This will overflow for type LINT +warning: This will overflow for type LINT ┌─ :23:42 │ 23 │ min_lint : LINT := ((-9_223_372_036_854_775_808 * 1) * 2); // -9_223_372_036_854_775_808 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type LINT -error: This will overflow for type LINT +warning: This will overflow for type LINT ┌─ :24:43 │ 24 │ max_lint : LINT := (( 9_223_372_036_854_775_807 * 1) * 2); // 9_223_372_036_854_775_807 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type LINT -error: This will overflow for type ULINT +warning: This will overflow for type ULINT ┌─ :25:43 │ 25 │ min_ulint : ULINT := ((1 * 1) * -2); // 0 │ ^^^^^^^^^^^ This will overflow for type ULINT -error: This will overflow for type ULINT +warning: This will overflow for type ULINT ┌─ :26:43 │ 26 │ max_ulint : ULINT := ((18_446_744_073_709_551_615 * 1) * 2); // 18_446_744_073_709_551_615 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type ULINT -error: This will overflow for type REAL +warning: This will overflow for type REAL ┌─ :29:39 │ 29 │ min_real : REAL := ((-3.40282347E+38 * 1) * 2); // -3.40282347E+38 │ ^^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type REAL -error: This will overflow for type REAL +warning: This will overflow for type REAL ┌─ :30:39 │ 30 │ max_real : REAL := (( 3.40282347E+38 * 1) * 2); // 3.40282347E+38 │ ^^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type REAL -error: This will overflow for type LREAL +warning: This will overflow for type LREAL ┌─ :33:41 │ 33 │ min_lreal : LREAL := ((-1.7976931348623157E+308 * 1) * 2); // -1.7976931348623157E+308 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type LREAL -error: This will overflow for type LREAL +warning: This will overflow for type LREAL ┌─ :34:41 │ 34 │ max_lreal : LREAL := (( 1.7976931348623157E+308 * 1) * 2); // 1.7976931348623157E+308 diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_globals.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_globals.snap index 016a72b4bd..d425ff3907 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_globals.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_globals.snap @@ -2,13 +2,13 @@ source: src/validation/tests/variable_validation_tests.rs expression: diagnostics --- -error: This will overflow for type INT +warning: This will overflow for type INT ┌─ :3:24 │ 3 │ a : INT := 32768; │ ^^^^^ This will overflow for type INT -error: This will overflow for type INT +warning: This will overflow for type INT ┌─ :4:24 │ 4 │ b : INT := 32767 + 1; diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_hex.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_hex.snap index 050a07db6d..05c95853e0 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_hex.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_hex.snap @@ -2,7 +2,7 @@ source: src/validation/tests/variable_validation_tests.rs expression: diagnostics --- -error: This will overflow for type WORD +warning: This will overflow for type WORD ┌─ :4:30 │ 4 │ y : UINT := WORD#16#fffff; // Not OK, should have been `ffff` not `ffff_f_` diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_literals.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_literals.snap index 66e6072599..5fe9f83b9d 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_literals.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_literals.snap @@ -2,121 +2,121 @@ source: src/validation/tests/variable_validation_tests.rs expression: diagnostics --- -error: This will overflow for type SINT +warning: This will overflow for type SINT ┌─ :5:40 │ 5 │ min_sint : SINT := -129; // -128 │ ^^^^ This will overflow for type SINT -error: This will overflow for type SINT +warning: This will overflow for type SINT ┌─ :6:41 │ 6 │ max_sint : SINT := 128; // 127 │ ^^^ This will overflow for type SINT -error: This will overflow for type USINT +warning: This will overflow for type USINT ┌─ :7:41 │ 7 │ min_usint : USINT := -1; // 0 │ ^^ This will overflow for type USINT -error: This will overflow for type USINT +warning: This will overflow for type USINT ┌─ :8:41 │ 8 │ max_usint : USINT := 257; // 256 │ ^^^ This will overflow for type USINT -error: This will overflow for type INT +warning: This will overflow for type INT ┌─ :11:39 │ 11 │ min_int : INT := -32_769; // -32768 │ ^^^^^^^ This will overflow for type INT -error: This will overflow for type INT +warning: This will overflow for type INT ┌─ :12:39 │ 12 │ max_int : INT := 32_768; // 32767 │ ^^^^^^ This will overflow for type INT -error: This will overflow for type UINT +warning: This will overflow for type UINT ┌─ :13:40 │ 13 │ min_uint : UINT := -1; // 0 │ ^^ This will overflow for type UINT -error: This will overflow for type UINT +warning: This will overflow for type UINT ┌─ :14:40 │ 14 │ max_uint : UINT := 65_537; // 65536 │ ^^^^^^ This will overflow for type UINT -error: This will overflow for type DINT +warning: This will overflow for type DINT ┌─ :17:40 │ 17 │ min_dint : DINT := -2_147_483_649; // -2_147_483_648 │ ^^^^^^^^^^^^^^ This will overflow for type DINT -error: This will overflow for type DINT +warning: This will overflow for type DINT ┌─ :18:41 │ 18 │ max_dint : DINT := 2_147_483_648; // 2_147_483_647 │ ^^^^^^^^^^^^^ This will overflow for type DINT -error: This will overflow for type UDINT +warning: This will overflow for type UDINT ┌─ :19:41 │ 19 │ min_udint : UDINT := -1; // 0 │ ^^ This will overflow for type UDINT -error: This will overflow for type UDINT +warning: This will overflow for type UDINT ┌─ :20:41 │ 20 │ max_udint : UDINT := 4_294_967_296; // 4_294_967_296 │ ^^^^^^^^^^^^^ This will overflow for type UDINT -error: This will overflow for type LINT +warning: This will overflow for type LINT ┌─ :23:40 │ 23 │ min_lint : LINT := -9_223_372_036_854_775_809; // -9_223_372_036_854_775_808 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type LINT -error: This will overflow for type LINT +warning: This will overflow for type LINT ┌─ :24:41 │ 24 │ max_lint : LINT := 9_223_372_036_854_775_808; // 9_223_372_036_854_775_807 │ ^^^^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type LINT -error: This will overflow for type ULINT +warning: This will overflow for type ULINT ┌─ :25:41 │ 25 │ min_ulint : ULINT := -1; // 0 │ ^^ This will overflow for type ULINT -error: This will overflow for type ULINT +warning: This will overflow for type ULINT ┌─ :26:41 │ 26 │ max_ulint : ULINT := 18_446_744_073_709_551_616; // 18_446_744_073_709_551_615 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type ULINT -error: This will overflow for type REAL +warning: This will overflow for type REAL ┌─ :29:37 │ 29 │ min_real : REAL := -3.50282347E+38; // -3.40282347E+38 │ ^^^^^^^^^^^^^^ This will overflow for type REAL -error: This will overflow for type REAL +warning: This will overflow for type REAL ┌─ :30:37 │ 30 │ max_real : REAL := 3.50282347E+38; // 3.40282347E+38 │ ^^^^^^^^^^^^^^ This will overflow for type REAL -error: This will overflow for type LREAL +warning: This will overflow for type LREAL ┌─ :33:39 │ 33 │ min_lreal : LREAL := -1.8076931348623157E+308; // -1.7976931348623157E+308 │ ^^^^^^^^^^^^^^^^^^^^^^^ This will overflow for type LREAL -error: This will overflow for type LREAL +warning: This will overflow for type LREAL ┌─ :34:39 │ 34 │ max_lreal : LREAL := 1.8076931348623157E+308; // 1.7976931348623157E+308 diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_non_global_constants.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_non_global_constants.snap index a3aaa4c797..0562d0845b 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_non_global_constants.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_non_global_constants.snap @@ -2,10 +2,10 @@ source: src/validation/tests/variable_validation_tests.rs expression: diagnostics --- -error: Unresolved constant 'c' variable: 'a' is no const reference +error: Unresolved constant `c` variable: `a` is no const reference ┌─ :5:24 │ 5 │ c : INT := a + b; // Will overflow - │ ^^^^^ Unresolved constant 'c' variable: 'a' is no const reference + │ ^^^^^ Unresolved constant `c` variable: `a` is no const reference diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_not.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_not.snap index b90dff4b55..7363377e46 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_not.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__overflows__overflows_with_not.snap @@ -2,7 +2,7 @@ source: src/validation/tests/variable_validation_tests.rs expression: diagnostics --- -error: This will overflow for type UINT +warning: This will overflow for type UINT ┌─ :4:25 │ 4 │ y : UINT := NOT -1234; // Not OK (because of -1234) diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__sized_varargs_require_type.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__sized_varargs_require_type.snap index b67da5750b..e30a8b54cf 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__sized_varargs_require_type.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__sized_varargs_require_type.snap @@ -2,10 +2,10 @@ source: src/validation/tests/variable_validation_tests.rs expression: "&diagnostics" --- -error: Missing datatype : Sized Variadics require a known datatype. +error: Missing datatype: Sized Variadics require a known datatype. ┌─ :5:27 │ 5 │ args : {sized}...; - │ ^^^ Missing datatype : Sized Variadics require a known datatype. + │ ^^^ Missing datatype: Sized Variadics require a known datatype. diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__unresolvable_variables_are_reported.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__unresolvable_variables_are_reported.snap index eb5d88255b..a6bae808c1 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__unresolvable_variables_are_reported.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__unresolvable_variables_are_reported.snap @@ -2,11 +2,11 @@ source: src/validation/tests/variable_validation_tests.rs expression: "&diagnostics" --- -error: Unresolved constant 'cx' variable +error: Unresolved constant `cx` variable ┌─ :19:29 │ 19 │ cx : INT := cx; //unresolvable - │ ^^ Unresolved constant 'cx' variable + │ ^^ Unresolved constant `cx` variable error: Could not resolve reference to a ┌─ :21:30 @@ -14,10 +14,10 @@ error: Could not resolve reference to a 21 │ cai : INT := a; //unresolvable │ ^ Could not resolve reference to a -error: Unresolved constant 'cai' variable +error: Unresolved constant `cai` variable ┌─ :21:30 │ 21 │ cai : INT := a; //unresolvable - │ ^ Unresolved constant 'cai' variable + │ ^ Unresolved constant `cai` variable diff --git a/src/validation/tests/statement_validation_tests.rs b/src/validation/tests/statement_validation_tests.rs index 5b908ae3e7..a5ee7f4398 100644 --- a/src/validation/tests/statement_validation_tests.rs +++ b/src/validation/tests/statement_validation_tests.rs @@ -847,6 +847,58 @@ fn validate_call_by_ref_explicit() { assert_snapshot!(&diagnostics); } +#[test] +fn exlicit_param_unknown_reference() { + let diagnostics = parse_and_validate_buffered( + " + FUNCTION_BLOCK func + VAR_INPUT + byValInput : INT; + END_VAR + END_FUNCTION_BLOCK + + PROGRAM main + VAR + fb: func; + END_VAR + + fb(unknown := 2); + fb(byVALInput := 2); //different case but valid + fb(byValInput := 2); //valid + + END_PROGRAM + ", + ); + assert_snapshot!(diagnostics) +} + +#[test] +fn exlicit_param_different_casing() { + let diagnostics = parse_and_validate_buffered( + " + FUNCTION_BLOCK func + VAR_INPUT + IN : INT; + IN2 : INT; + END_VAR + END_FUNCTION_BLOCK + + PROGRAM main + VAR + fb: func; + END_VAR + + fb(in := 2); + fb(in := 2, IN2 := 3); + fb(IN := 2, in2 := 3); + fb(in := 2, in2 := 3); + END_PROGRAM + ", + ); + + assert_snapshot!(diagnostics) +} + #[test] fn implicit_param_downcast_in_function_call() { let diagnostics = parse_and_validate_buffered( diff --git a/src/validation/types.rs b/src/validation/types.rs index af27651df1..99c6ac4c51 100644 --- a/src/validation/types.rs +++ b/src/validation/types.rs @@ -47,21 +47,28 @@ fn validate_data_type(validator: &mut Validator, data_type: &DataType, location: match data_type { DataType::StructType { variables, .. } => { if variables.is_empty() { - validator.push_diagnostic(Diagnostic::empty_variable_block(location.clone())); + validator.push_diagnostic( + Diagnostic::error("Variable block is empty") + .with_error_code("E028") + .with_location(location.clone()), + ); } } DataType::EnumType { elements: AstNode { stmt: AstStatement::ExpressionList(expressions), .. }, .. } if expressions.is_empty() => { - validator.push_diagnostic(Diagnostic::empty_variable_block(location.clone())); - } - DataType::VarArgs { referenced_type: None, sized: true } => { - validator.push_diagnostic(Diagnostic::missing_datatype( - Some(": Sized Variadics require a known datatype."), - location.clone(), - )) + validator.push_diagnostic( + Diagnostic::error("Variable block is empty") + .with_error_code("E028") + .with_location(location.clone()), + ); } + DataType::VarArgs { referenced_type: None, sized: true } => validator.push_diagnostic( + Diagnostic::error("Missing datatype: Sized Variadics require a known datatype.") + .with_error_code("E038") + .with_location(location.clone()), + ), _ => {} } } diff --git a/src/validation/variable.rs b/src/validation/variable.rs index 85f499906d..080146d44b 100644 --- a/src/validation/variable.rs +++ b/src/validation/variable.rs @@ -33,7 +33,11 @@ fn validate_variable_block(validator: &mut Validator, block: &VariableBlock) { if block.constant && !matches!(block.variable_block_type, VariableBlockType::Global | VariableBlockType::Local) { - validator.push_diagnostic(Diagnostic::invalid_constant_block(block.location.clone())) + validator.push_diagnostic( + Diagnostic::error("This variable block does not support the CONSTANT modifier") + .with_error_code("E034") + .with_location(block.location.clone()), + ) } } @@ -52,25 +56,31 @@ pub fn visit_variable( /// - InOut within Function-Block fn validate_vla(validator: &mut Validator, pou: Option<&Pou>, block: &VariableBlock, variable: &Variable) { let Some(pou) = pou else { + if matches!(block.variable_block_type, VariableBlockType::Global) { - validator.push_diagnostic(Diagnostic::invalid_vla_container( - "VLAs can not be defined as global variables".to_string(), - variable.location.clone(), - )) + validator.push_diagnostic(Diagnostic::error("VLAs can not be defined as global variables") + .with_error_code("E044") + .with_location( variable.location.clone()) + ) } return; }; match (&pou.pou_type, block.variable_block_type) { - (PouType::Function, VariableBlockType::Input(ArgumentProperty::ByVal)) => { - validator.push_diagnostic(Diagnostic::vla_by_val_warning(variable.location.clone())) - } - - (PouType::Program, _) => validator.push_diagnostic(Diagnostic::invalid_vla_container( - "Variable Length Arrays are not allowed to be defined inside a Program".to_string(), - variable.location.clone(), - )), + (PouType::Function, VariableBlockType::Input(ArgumentProperty::ByVal)) => validator.push_diagnostic( + Diagnostic::warning( + "Variable Length Arrays are always by-ref, even when declared in a by-value block", + ) + .with_error_code("E047") + .with_location(variable.location.clone()), + ), + + (PouType::Program, _) => validator.push_diagnostic( + Diagnostic::error("Variable Length Arrays are not allowed to be defined inside a Program") + .with_error_code("E044") + .with_location(variable.location.clone()), + ), ( PouType::Function | PouType::Method { .. }, @@ -80,13 +90,14 @@ fn validate_vla(validator: &mut Validator, pou: Option<&Pou>, block: &VariableBl ) | (PouType::FunctionBlock, VariableBlockType::InOut) => (), - _ => validator.push_diagnostic(Diagnostic::invalid_vla_container( - format!( + _ => validator.push_diagnostic( + Diagnostic::error(format!( "Variable Length Arrays are not allowed to be defined as {} variables inside a {}", block.variable_block_type, pou.pou_type - ), - variable.location.clone(), - )), + )) + .with_error_code("E044") + .with_location(variable.location.clone()), + ), } } @@ -113,25 +124,29 @@ fn validate_variable( .and_then(|initial_id| context.index.get_const_expressions().find_const_expression(&initial_id)) { Some(ConstExpression::Unresolvable { reason, statement }) if reason.is_misc() => { - validator.push_diagnostic(Diagnostic::unresolved_constant( - variable.name.as_str(), - Some(reason.get_reason()), - statement.get_location(), - )); + validator.push_diagnostic( + Diagnostic::error(format!( + "Unresolved constant `{}` variable: {}", + variable.name.as_str(), + reason.get_reason() + )) + .with_error_code("E033") + .with_location(statement.get_location()), + ); } Some(ConstExpression::Unresolved { statement, .. }) => { - validator.push_diagnostic(Diagnostic::unresolved_constant( - variable.name.as_str(), - None, - statement.get_location(), - )); + validator.push_diagnostic( + Diagnostic::error(format!("Unresolved constant `{}` variable", variable.name.as_str(),)) + .with_error_code("E033") + .with_location(statement.get_location()), + ); } None if v_entry.is_constant() => { - validator.push_diagnostic(Diagnostic::unresolved_constant( - variable.name.as_str(), - None, - variable.location.clone(), - )); + validator.push_diagnostic( + Diagnostic::error(format!("Unresolved constant `{}` variable", variable.name.as_str(),)) + .with_error_code("E033") + .with_location(variable.location.clone()), + ); } _ => { if let Some(rhs) = variable.initializer.as_ref() { @@ -152,8 +167,14 @@ fn validate_variable( // check if we declared a constant fb-instance or class-instance if v_entry.is_constant() && data_type_is_fb_or_class_instance(v_entry.get_type_name(), context.index) { - validator - .push_diagnostic(Diagnostic::invalid_constant(v_entry.get_name(), variable.location.clone())); + validator.push_diagnostic( + Diagnostic::error(format!( + "Invalid constant {} - Functionblock- and Class-instances cannot be delcared constant", + v_entry.get_name() + )) + .with_error_code("E035") + .with_location(variable.location.clone()), + ); } } } diff --git a/tests/correctness/arithmetic_functions/multiplication.rs b/tests/correctness/arithmetic_functions/multiplication.rs index 9e22ce2db6..eefb5c2370 100644 --- a/tests/correctness/arithmetic_functions/multiplication.rs +++ b/tests/correctness/arithmetic_functions/multiplication.rs @@ -14,7 +14,7 @@ fn mul_with_ints() { END_FUNCTION "#; - let expected = 1 * 2 * 3 * 4 * 1000 * 5; + let expected = 2 * 3 * 4 * 1000 * 5; let res: i64 = compile_and_run_no_params(prog.to_string()); assert_eq!(expected, res); } diff --git a/tests/correctness/comparison_functions/equal.rs b/tests/correctness/comparison_functions/equal.rs index f255fcdab7..668b47d9cb 100644 --- a/tests/correctness/comparison_functions/equal.rs +++ b/tests/correctness/comparison_functions/equal.rs @@ -17,7 +17,7 @@ fn builtin_eq_with_ints_monotonic() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } #[test] @@ -37,7 +37,7 @@ fn builtin_eq_with_ints() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -57,7 +57,7 @@ fn builtin_eq_with_floats_monotonic() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } #[test] @@ -77,7 +77,7 @@ fn builtin_eq_with_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -98,5 +98,5 @@ fn builtin_eq_with_mixed_ints_and_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } diff --git a/tests/correctness/comparison_functions/greater_than.rs b/tests/correctness/comparison_functions/greater_than.rs index 040a6cb71c..b9ac5a6a61 100644 --- a/tests/correctness/comparison_functions/greater_than.rs +++ b/tests/correctness/comparison_functions/greater_than.rs @@ -17,7 +17,7 @@ fn builtin_gt_with_ints_descending() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } #[test] @@ -37,7 +37,7 @@ fn builtin_gt_with_ints() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -57,7 +57,7 @@ fn builtin_gt_with_floats_descending() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } #[test] @@ -77,7 +77,7 @@ fn builtin_gt_with_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -98,5 +98,5 @@ fn builtin_gt_with_mixed_ints_and_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } diff --git a/tests/correctness/comparison_functions/greater_than_or_equal.rs b/tests/correctness/comparison_functions/greater_than_or_equal.rs index 6033a9bd57..8c008c3456 100644 --- a/tests/correctness/comparison_functions/greater_than_or_equal.rs +++ b/tests/correctness/comparison_functions/greater_than_or_equal.rs @@ -17,7 +17,7 @@ fn builtin_ge_with_ints_monotonic() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } #[test] @@ -37,7 +37,7 @@ fn builtin_ge_with_ints() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -57,7 +57,7 @@ fn builtin_ge_with_floats_monotonic() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } #[test] @@ -77,7 +77,7 @@ fn builtin_ge_with_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -98,5 +98,5 @@ fn builtin_ge_with_mixed_ints_and_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } diff --git a/tests/correctness/comparison_functions/less_than.rs b/tests/correctness/comparison_functions/less_than.rs index f09b86baec..7dbac04617 100644 --- a/tests/correctness/comparison_functions/less_than.rs +++ b/tests/correctness/comparison_functions/less_than.rs @@ -17,7 +17,7 @@ fn builtin_lt_with_ints_monotonic() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -37,7 +37,7 @@ fn builtin_lt_with_ints() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -57,7 +57,7 @@ fn builtin_lt_with_floats_monotonic() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -77,7 +77,7 @@ fn builtin_lt_with_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -98,5 +98,5 @@ fn builtin_lt_with_mixed_ints_and_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } diff --git a/tests/correctness/comparison_functions/less_than_or_equal.rs b/tests/correctness/comparison_functions/less_than_or_equal.rs index c9b2af6e4a..5bc1743ad2 100644 --- a/tests/correctness/comparison_functions/less_than_or_equal.rs +++ b/tests/correctness/comparison_functions/less_than_or_equal.rs @@ -17,7 +17,7 @@ fn builtin_le_with_ints_monotonic() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } #[test] @@ -37,7 +37,7 @@ fn builtin_le_with_ints() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -57,7 +57,7 @@ fn builtin_le_with_floats_monotonic() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } #[test] @@ -77,7 +77,7 @@ fn builtin_le_with_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -98,5 +98,5 @@ fn builtin_le_with_mixed_ints_and_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } diff --git a/tests/correctness/comparison_functions/not_equal.rs b/tests/correctness/comparison_functions/not_equal.rs index bf9b243f1a..c1459eace7 100644 --- a/tests/correctness/comparison_functions/not_equal.rs +++ b/tests/correctness/comparison_functions/not_equal.rs @@ -17,7 +17,7 @@ fn builtin_ne_with_ints_monotonic() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -37,7 +37,7 @@ fn builtin_ne_with_ints() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } #[test] @@ -57,7 +57,7 @@ fn builtin_ne_with_floats_monotonic() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, false); + assert!(!res); } #[test] @@ -77,7 +77,7 @@ fn builtin_ne_with_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } #[test] @@ -98,5 +98,5 @@ fn builtin_ne_with_mixed_ints_and_floats() { let mut main = MainType::default(); let res: bool = compile_and_run(prog.to_string(), &mut main); - assert_eq!(res, true); + assert!(res); } diff --git a/tests/integration/cfc.rs b/tests/integration/cfc.rs index 0caea6745d..da4d1fc5bd 100644 --- a/tests/integration/cfc.rs +++ b/tests/integration/cfc.rs @@ -307,7 +307,7 @@ mod ir { #[test] // TODO: Transfer this test to `codegen/tests/debug_tests/cfc.rs` once `test_utils.rs` has been refactored fn conditional_return_debug() { - let declaration = "FUNCTION foo VAR_INPUT val : DINT; END_VAR"; + let declaration = "FUNCTION foo : DINT VAR_INPUT val : DINT; END_VAR"; let content = SPou::init("foo", "function", declaration).with_fbd(vec![ // IF val = 1 THEN RETURN &SInVariable::id(2).with_expression("val = 5"), diff --git a/tests/integration/cfc/validation_tests.rs b/tests/integration/cfc/validation_tests.rs index 312d7ceabb..0b7f2d5b05 100644 --- a/tests/integration/cfc/validation_tests.rs +++ b/tests/integration/cfc/validation_tests.rs @@ -15,7 +15,7 @@ fn duplicate_label_validation() { let mut diagnostician = Diagnostician::buffered(); diagnostician.register_file(".cfc".to_string(), "".into()); let (ctxt, project) = parse_and_annotate("plc", vec![cfc_file]).unwrap(); - project.validate(&ctxt, &mut diagnostician).unwrap(); + project.validate(&ctxt, &mut diagnostician).expect_err("Expecting a validation problem"); assert_snapshot!(diagnostician.buffer().unwrap()) } diff --git a/tests/integration/linking.rs b/tests/integration/linking.rs index 606ce774a1..bd0d42fe6b 100644 --- a/tests/integration/linking.rs +++ b/tests/integration/linking.rs @@ -134,11 +134,7 @@ fn link_missing_file() { match res { Err(err) => { - assert!(err - .into_diagnostic() - .unwrap() - .get_message() - .contains("Compilation aborted due to previous errors")); + assert!(err.to_string().contains("Compilation aborted due to previous errors")); } _ => panic!("Expected link failure"), } diff --git a/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_debug.snap b/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_debug.snap index b3fe2cfa4c..aaeb884ce6 100644 --- a/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_debug.snap +++ b/tests/integration/snapshots/tests__integration__cfc__ir__conditional_return_debug.snap @@ -2,21 +2,26 @@ source: tests/integration/cfc.rs expression: output_file_content_without_headers --- -define void @foo(i32 %0) !dbg !3 { +define i32 @foo(i32 %0) !dbg !3 { entry: + %foo = alloca i32, align 4, !dbg !8 %val = alloca i32, align 4, !dbg !8 call void @llvm.dbg.declare(metadata i32* %val, metadata !9, metadata !DIExpression()), !dbg !10 store i32 %0, i32* %val, align 4, !dbg !8 - %load_val = load i32, i32* %val, align 4, !dbg !11 - %tmpVar = icmp eq i32 %load_val, 5, !dbg !11 - br i1 %tmpVar, label %then_block, label %else_block, !dbg !11 + call void @llvm.dbg.declare(metadata i32* %foo, metadata !11, metadata !DIExpression()), !dbg !12 + store i32 0, i32* %foo, align 4, !dbg !8 + %load_val = load i32, i32* %val, align 4, !dbg !13 + %tmpVar = icmp eq i32 %load_val, 5, !dbg !13 + br i1 %tmpVar, label %then_block, label %else_block, !dbg !13 then_block: ; preds = %entry - ret void, !dbg !8 + %foo_ret = load i32, i32* %foo, align 4, !dbg !8 + ret i32 %foo_ret, !dbg !8 else_block: ; preds = %entry - store i32 10, i32* %val, align 4, !dbg !12 - ret void, !dbg !12 + store i32 10, i32* %val, align 4, !dbg !14 + %foo_ret1 = load i32, i32* %foo, align 4, !dbg !14 + ret i32 %foo_ret1, !dbg !14 } ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn @@ -37,6 +42,8 @@ attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } !7 = !{} !8 = !DILocation(line: 3, scope: !3) !9 = !DILocalVariable(name: "val", scope: !3, file: !2, line: 1, type: !6) -!10 = !DILocation(line: 1, column: 23, scope: !3) -!11 = !DILocation(line: 2, scope: !3) -!12 = !DILocation(line: 5, scope: !3) +!10 = !DILocation(line: 1, column: 30, scope: !3) +!11 = !DILocalVariable(name: "foo", scope: !3, file: !2, line: 1, type: !6, align: 32) +!12 = !DILocation(line: 1, column: 9, scope: !3) +!13 = !DILocation(line: 2, scope: !3) +!14 = !DILocation(line: 5, scope: !3)