Skip to content
Merged
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
3 changes: 3 additions & 0 deletions sway-core/src/language/ty/expression/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,9 @@ impl MaterializeConstGenerics for TyExpression {
exp.materialize_const_generics(engines, handler, name, value)
}
TyExpressionVariant::Continue | TyExpressionVariant::Break => Ok(()),
TyExpressionVariant::AbiCast { address, .. } => {
address.materialize_const_generics(engines, handler, name, value)
}
_ => Err(handler.emit_err(
sway_error::error::CompileError::ConstGenericNotSupportedHere {
span: self.span.clone(),
Expand Down
4 changes: 1 addition & 3 deletions sway-core/src/semantic_analysis/cei_pattern_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,11 @@ fn analyze_expression(
use crate::ty::TyExpressionVariant::*;
let decl_engine = engines.de();
match &expr.expression {
ConstGenericExpression { .. } => {
todo!("Will be implemented by https://github.com/FuelLabs/sway/issues/6860")
}
// base cases: no warnings can be emitted
Literal(_)
| ConstantExpression { .. }
| ConfigurableExpression { .. }
| ConstGenericExpression { .. }
| VariableExpression { .. }
| FunctionParameter
| StorageAccess(_)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ abi TestAbi {
}

#[storage(write)]
fn standalone_function() {
fn standalone_function<const N: u64>() {
let other_contract = abi(TestAbi, 0x3dba0a4455b598b7655a7fb430883d96c9527ef275b49739e7b0ad12f8280eae);

let _ = __dbg(N);

// interaction
other_contract.deposit();
// effect -- therefore violation of CEI where effect should go before interaction
Expand All @@ -21,6 +23,6 @@ fn standalone_function() {
impl TestAbi for Contract {
#[storage(write)]
fn deposit() {
standalone_function();
standalone_function::<5>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ category = "compile"

# check: $()Storage write after external contract interaction in function or method "standalone_function". Consider making all storage writes before calling another contract
expected_warnings = 2
experimental = { const_generics = true }
Loading