@@ -138,6 +138,8 @@ pub enum PathKind {
138
138
Unknown ,
139
139
/// A path with at least one coinductive step. Such cycles hold.
140
140
Coinductive ,
141
+ /// A path which is treated as ambiguous.
142
+ ForcedAmbiguity ,
141
143
}
142
144
143
145
impl PathKind {
@@ -150,6 +152,9 @@ impl PathKind {
150
152
/// to `max(self, rest)`.
151
153
fn extend ( self , rest : PathKind ) -> PathKind {
152
154
match ( self , rest) {
155
+ ( PathKind :: ForcedAmbiguity , _) | ( _, PathKind :: ForcedAmbiguity ) => {
156
+ PathKind :: ForcedAmbiguity
157
+ }
153
158
( PathKind :: Coinductive , _) | ( _, PathKind :: Coinductive ) => PathKind :: Coinductive ,
154
159
( PathKind :: Unknown , _) | ( _, PathKind :: Unknown ) => PathKind :: Unknown ,
155
160
( PathKind :: Inductive , PathKind :: Inductive ) => PathKind :: Inductive ,
@@ -321,7 +326,10 @@ impl CycleHeads {
321
326
322
327
let path_from_entry = match step_kind {
323
328
PathKind :: Coinductive => AllPathsToHeadCoinductive :: Yes ,
324
- PathKind :: Unknown | PathKind :: Inductive => path_from_entry,
329
+ // TODO
330
+ PathKind :: Unknown | PathKind :: Inductive | PathKind :: ForcedAmbiguity => {
331
+ path_from_entry
332
+ }
325
333
} ;
326
334
327
335
self . insert ( head, path_from_entry) ;
@@ -348,6 +356,7 @@ bitflags::bitflags! {
348
356
const INDUCTIVE = 1 << 1 ;
349
357
const UNKNOWN = 1 << 2 ;
350
358
const COINDUCTIVE = 1 << 3 ;
359
+ const FORCED_AMBIGUITY = 1 << 4 ;
351
360
}
352
361
}
353
362
impl From < PathKind > for PathsToNested {
@@ -356,6 +365,7 @@ impl From<PathKind> for PathsToNested {
356
365
PathKind :: Inductive => PathsToNested :: INDUCTIVE ,
357
366
PathKind :: Unknown => PathsToNested :: UNKNOWN ,
358
367
PathKind :: Coinductive => PathsToNested :: COINDUCTIVE ,
368
+ PathKind :: ForcedAmbiguity => PathsToNested :: FORCED_AMBIGUITY ,
359
369
}
360
370
}
361
371
}
@@ -388,6 +398,22 @@ impl PathsToNested {
388
398
self . insert ( PathsToNested :: COINDUCTIVE ) ;
389
399
}
390
400
}
401
+ PathKind :: ForcedAmbiguity => {
402
+ if self . intersects (
403
+ PathsToNested :: EMPTY
404
+ | PathsToNested :: INDUCTIVE
405
+ | PathsToNested :: UNKNOWN
406
+ | PathsToNested :: COINDUCTIVE ,
407
+ ) {
408
+ self . remove (
409
+ PathsToNested :: EMPTY
410
+ | PathsToNested :: INDUCTIVE
411
+ | PathsToNested :: UNKNOWN
412
+ | PathsToNested :: COINDUCTIVE ,
413
+ ) ;
414
+ self . insert ( PathsToNested :: FORCED_AMBIGUITY ) ;
415
+ }
416
+ }
391
417
}
392
418
393
419
self
0 commit comments