Skip to content

Commit

Permalink
added None & Some
Browse files Browse the repository at this point in the history
  • Loading branch information
dean-starkware committed Jan 25, 2025
1 parent e90be20 commit deeb581
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
2 changes: 2 additions & 0 deletions corelib/src/prelude/v2023_01.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ use crate::integer::{
u8,
};
use crate::nullable::{Nullable, NullableTrait, match_nullable, null, nullable_from_box};
use crate::option::Option::{None, Some};
use crate::option::{Option, OptionTrait};
use crate::panics::{Panic, PanicResult, panic};
use crate::pedersen::Pedersen;
use crate::poseidon::Poseidon;
use crate::result::Result::{Err, Ok};
use crate::result::{Result, ResultTrait};
use crate::serde::Serde;
use crate::starknet::System;
Expand Down
2 changes: 2 additions & 0 deletions corelib/src/prelude/v2023_10.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ pub use crate::traits::RemEq;
)]
#[feature("deprecated-op-assign-traits")]
pub use crate::traits::SubEq;
use crate::option::Option::{None, Some};
use crate::result::Result::{Err, Ok};
2 changes: 2 additions & 0 deletions corelib/src/prelude/v2024_07.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ pub use crate::traits::{
};
pub use crate::iter::{FromIterator, IntoIterator, Iterator};
pub use crate::{assert, bool, felt252, starknet, usize};
use crate::option::Option::{None, Some};
use crate::result::Result::{Err, Ok};

pub use crate::zeroable::NonZero;
4 changes: 2 additions & 2 deletions crates/cairo-lang-semantic/src/expr/test_data/if
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ error: Logical operator not allowed in if-let.
if let Some(y) = x || true {
^^^^^^^^^

error: Identifier not found.
error: Wrong enum in pattern. Expected: "core::bool". Got: "core::option::Option".
--> lib.cairo:3:12
if let Some(y) = x || true {
^^^^
^^^^^^^

error: Identifier not found.
--> lib.cairo:4:16
Expand Down
11 changes: 1 addition & 10 deletions crates/cairo-lang-semantic/src/expr/test_data/statements
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ foo
//! > Blocks, `if`s, and `match`s, don't require semicolon, even not in tail expressions.

//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)
test_function_diagnostics(expect_diagnostics: false)

//! > function
fn foo() {
Expand All @@ -165,15 +165,6 @@ foo
//! > module_code

//! > expected_diagnostics
error: Identifier not found.
--> lib.cairo:7:9
Some(_) => {},
^^^^

error: Identifier not found.
--> lib.cairo:8:9
None(_) => {},
^^^^

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

Expand Down

0 comments on commit deeb581

Please sign in to comment.