Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/cairo-lang-semantic/src/corelib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub fn try_get_ty_by_name<'db>(
}
_ => GenericTypeId::option_from(module_item_id),
}
.unwrap_or_else(|| panic!("{} is not a type.", name.long(db)));
.ok_or(SemanticDiagnosticKind::NotAType)?;

Ok(semantic::TypeLongId::Concrete(semantic::ConcreteTypeId::new(
db,
Expand Down
21 changes: 21 additions & 0 deletions crates/cairo-lang-semantic/src/expr/test_data/literal
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,24 @@ error[E2008]: A numeric literal of type core::pedersen::Pedersen cannot be creat
--> lib.cairo:2:14
let _a = 'a'_Pedersen;
^^^^^^^^^^^^

//! > ==========================================================================

//! > Numeric literal with a non-type suffix.

//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)

//! > function_code
fn foo() {
let _x = 1_boolean;
}

//! > function_name
foo

//! > expected_diagnostics
error[E2011]: Not a type.
--> lib.cairo:2:14
let _x = 1_boolean;
^^^^^^^^^
Loading