Phase 2: TypeOp変換の一本化(Optimizer安全ネット削除)\nPhase 3: 可視化/スナップショット基盤(--mir-verbose-effects, snapshot/compare/ci_check)\nDocs: Phase 1/2 完了マーク・利用方法追記
This commit is contained in:
@ -129,7 +129,8 @@ impl EffectMask {
|
||||
|
||||
/// Check if the computation is pure (no side effects)
|
||||
pub fn is_pure(self) -> bool {
|
||||
self.contains(Effect::Pure) || self.0 == 0
|
||||
// 純粋性は一次カテゴリで判定(Pureビットが立っていてもIO/WRITE/CONTROL等があれば純粋ではない)
|
||||
self.primary_category() == Effect::Pure
|
||||
}
|
||||
|
||||
/// Check if the computation is mutable (modifies state)
|
||||
@ -346,5 +347,9 @@ mod tests {
|
||||
let display = format!("{}", read_io);
|
||||
assert!(display.contains("read"));
|
||||
assert!(display.contains("io"));
|
||||
|
||||
// is_pure should be false when IO is present, even if PURE bit was set initially
|
||||
let mixed = EffectMask::PURE | EffectMask::IO;
|
||||
assert!(!mixed.is_pure());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user