@@ -184,7 +184,7 @@ pub(crate) struct TypedCast<TypeRep> {
184
184
pub ( crate ) mod inference {
185
185
use std:: collections:: HashSet ;
186
186
187
- use crate :: core:: { Bounds , Expr , NumRep } ;
187
+ use crate :: core:: { Bounds , Expr , MachineRep , NumRep } ;
188
188
189
189
use super :: { IntType , PrimInt } ;
190
190
@@ -253,13 +253,6 @@ pub(crate) mod inference {
253
253
}
254
254
}
255
255
256
- // pub fn as_backref(&self) -> Option<usize> {
257
- // match self {
258
- // Alias::Ground | Alias::Canonical(_) => None,
259
- // Alias::BackRef(ix) => Some(*ix),
260
- // }
261
- // }
262
-
263
256
pub fn add_forward_ref ( & mut self , tgt : usize ) {
264
257
match self {
265
258
Alias :: Ground => {
@@ -327,7 +320,7 @@ pub(crate) mod inference {
327
320
}
328
321
329
322
impl Constraint {
330
- /// Speculatively checks if this constraint is definiitely satisfiable (as-is) by a given type-assignment.
323
+ /// Speculatively checks if this constraint is definitely satisfiable (as-is) by a given type-assignment.
331
324
///
332
325
/// If this is not statically deterministic, returns `None`.
333
326
/// Returns `Some(true)` if the constraint is satisfiable by the assignment, and `Some(false)` otherwise.
@@ -341,30 +334,13 @@ pub(crate) mod inference {
341
334
let IntType :: Prim ( candidate) = candidate;
342
335
Some (
343
336
bounds. is_encompassed_by (
344
- & <PrimInt as Into < NumRep > >:: into ( candidate)
345
- . as_bounds ( )
346
- . unwrap ( ) ,
337
+ & <PrimInt as Into < MachineRep > >:: into ( candidate) . as_bounds ( )
347
338
) ,
348
339
)
349
340
}
350
341
}
351
342
}
352
343
353
- // pub(crate) fn has_unique_assignment(&self) -> bool {
354
- // // REVIEW - there are smarter ways of calculating this
355
- // let mut solutions = 0;
356
- // for prim_int in super::PRIM_INTS.iter() {
357
- // match self.is_satisfied_by(IntType::Prim(*prim_int)) {
358
- // Some(true) => {
359
- // solutions += 1;
360
- // }
361
- // Some(false) => (),
362
- // None => return false,
363
- // }
364
- // }
365
- // solutions == 1
366
- // }
367
-
368
344
// NOTE - should only be called on Encompasses
369
345
pub ( crate ) fn get_unique_solution ( & self ) -> InferenceResult < IntType > {
370
346
// REVIEW - there are smarter ways of calculating this
@@ -759,9 +735,8 @@ pub(crate) mod inference {
759
735
UType :: Int ( int_type) => {
760
736
let IntType :: Prim ( candidate) = int_type;
761
737
let soluble = bounds. is_encompassed_by (
762
- & <PrimInt as Into < NumRep > >:: into ( candidate)
763
- . as_bounds ( )
764
- . unwrap ( ) ,
738
+ & <PrimInt as Into < MachineRep > >:: into ( candidate)
739
+ . as_bounds ( ) ,
765
740
) ;
766
741
if soluble {
767
742
Ok ( Constraint :: Equiv ( utype) )
0 commit comments