Skip to content

Commit 1dcdf7c

Browse files
authored
increase validator precision in an edge case (#615)
1 parent 2c45675 commit 1dcdf7c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cedar-policy-validator/src/types.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,14 +482,18 @@ impl Type {
482482
}
483483

484484
/// Return true if we know that any value in this type must be a specified
485-
/// entity. An unspecified entity has type `AnyEntity`, so `AnyEntity` might
486-
/// not be specified. Other entity types must be specified.
485+
/// entity.
487486
pub(crate) fn must_be_specified_entity(ty: &Type) -> bool {
488487
matches!(
489488
ty,
489+
// An unspecified entity has type `AnyEntity`, so `AnyEntity` might
490+
// not be specified. Other entity types must be specified.
490491
Type::EntityOrRecord(
491492
EntityRecordKind::Entity(_) | EntityRecordKind::ActionEntity { .. }
492493
)
494+
// It is vacuously true that any value in the type `Never` is a
495+
// specified entity.
496+
| Type::Never
493497
)
494498
}
495499

0 commit comments

Comments
 (0)