Compare two mutual constants with caching. Dispatches to the appropriate type-specific comparator (defn, indc, recr). Different-kind constants are ordered by kind tag.
( x: &MutConst, y: &MutConst, mut_ctx: &MutCtx, cache: &mut BlockCache, stt: &CompileState, )
| 2805 | }, |
| 2806 | (LevelData::Succ(_, _), _) => Ok(SOrd::lt(true)), |
| 2807 | (_, LevelData::Succ(_, _)) => Ok(SOrd::gt(true)), |
| 2808 | (LevelData::Max(xl, xr, _), LevelData::Max(yl, yr, _)) => { |
| 2809 | SOrd::try_compare(compare_level(xl, yl, x_ctx, y_ctx)?, || { |
| 2810 | compare_level(xr, yr, x_ctx, y_ctx) |
| 2811 | }) |
| 2812 | }, |
| 2813 | (LevelData::Max(_, _, _), _) => Ok(SOrd::lt(true)), |
| 2814 | (_, LevelData::Max(_, _, _)) => Ok(SOrd::gt(true)), |
| 2815 | (LevelData::Imax(xl, xr, _), LevelData::Imax(yl, yr, _)) => { |
| 2816 | SOrd::try_compare(compare_level(xl, yl, x_ctx, y_ctx)?, || { |
| 2817 | compare_level(xr, yr, x_ctx, y_ctx) |
| 2818 | }) |
| 2819 | }, |
| 2820 | (LevelData::Imax(_, _, _), _) => Ok(SOrd::lt(true)), |
| 2821 | (_, LevelData::Imax(_, _, _)) => Ok(SOrd::gt(true)), |
| 2822 | (LevelData::Param(x, _), LevelData::Param(y, _)) => { |
| 2823 | match ( |
| 2824 | x_ctx.iter().position(|n| x == n), |
| 2825 | y_ctx.iter().position(|n| y == n), |
| 2826 | ) { |
| 2827 | (Some(xi), Some(yi)) => Ok(SOrd::cmp(&xi, &yi)), |
| 2828 | (None, _) => Err(CompileError::UnknownUnivParam { |
| 2829 | curr: String::new(), |
| 2830 | param: x.pretty(), |
| 2831 | }), |
| 2832 | (_, None) => Err(CompileError::UnknownUnivParam { |
| 2833 | curr: String::new(), |
| 2834 | param: y.pretty(), |
| 2835 | }), |
| 2836 | } |
| 2837 | }, |
no test coverage detected