pub fn term_to_subtype_ind(&self, term: Spanned<Term>) -> Result<Spanned<hir::SubtypeInd>> {
        let term = self.fold_term_as_type(term)?;
        let (tm, resol, con) = match term.value {
            Term::SubtypeInd(tm, resol, con) => (tm, resol, con),
            Term::TypeMark(tm) => (tm, None, None),
            _ => {
                self.emit(
                    DiagBuilder2::error(format!(
                        "`{}` is not a subtype indication",
                        term.span.extract()
                    ))
                    .span(term.span),
                );
                debugln!("It is a {:#?}", term);
                return Err(());
            }
        };
        let _resol = match resol {
            Some(x) => Some(self.term_to_resolution_indication(*x)?),
            None => None,
        };
        let con = match con {
            Some(x) => Some(self.term_to_constraint(*x)?),
            None => None,
        };
        Ok(Spanned::new(
            hir::SubtypeInd {
                span: term.span,
                type_mark: tm,
                // TODO: Track resolution indication.
                constraint: con,
            },
            term.span,
        ))
        // let id = SubtypeIndRef::new(NodeId::alloc());
        // self.ctx.set_hir(id, self.ctx.sb.arenas.hir.subtype_ind.alloc(hir));
        // Ok(Spanned::new(id, term.span))
    }
/// Map a term to a subtype indication.
Map a term to a subtype indication.
Map a term to a subtype indication .
pub fn term_to_subtype_ind(&self, term: Spanned<Term>) -> Result<Spanned<hir::SubtypeInd>> {
        let term = self.fold_term_as_type(term)?;
        let (tm, resol, con) = match term.value {
            Term::SubtypeInd(tm, resol, con) => (tm, resol, con),
            Term::TypeMark(tm) => (tm, None, None),
            _ => {
                self.emit(
                    DiagBuilder2::error(format!(
                        "`{}` is not a subtype indication",
                        term.span.extract()
                    ))
                    .span(term.span),
                );
                debugln!("It is a {:#?}", term);
                return Err(());
            }
        };
        let _resol = match resol {
            Some(x) => Some(self.term_to_resolution_indication(*x)?),
            None => None,
        };
        let con = match con {
            Some(x) => Some(self.term_to_constraint(*x)?),
            None => None,
        };
        Ok(Spanned::new(
            hir::SubtypeInd {
                span: term.span,
                type_mark: tm,
                // TODO: Track resolution indication.
                constraint: con,
            },
            term.span,
        ))
        // let id = SubtypeIndRef::new(NodeId::alloc());
        // self.ctx.set_hir(id, self.ctx.sb.arenas.hir.subtype_ind.alloc(hir));
        // Ok(Spanned::new(id, term.span))
    }
pub fn term_to_subtype_ind ( & self , term : Spanned < Term > ) -> Result < Spanned < hir :: SubtypeInd > > { let term = self . fold_term_as_type ( term ) ? ; let ( tm , resol , con ) = match term . value { Term :: SubtypeInd ( tm , resol , con ) => ( tm , resol , con ) , Term :: TypeMark ( tm ) => ( tm , None , None ) , _ => { self . emit ( DiagBuilder2 :: error ( format ! ( " " term span extract ( ) ) ) . span ( term . span ) , ) ; debugln ! ( " " term ) ; return Err ( ( ) ) ; } } ; let _resol = match resol { Some ( x ) => Some ( self . term_to_resolution_indication ( * x ) ? ) , None => None , } ; let con = match con { Some ( x ) => Some ( self . term_to_constraint ( * x ) ? ) , None => None , } ; Ok ( Spanned :: new ( hir :: SubtypeInd { span : term . span , type_mark : tm , // TODO: Track resolution indication. constraint : con , } , term . span , ) ) // let id = SubtypeIndRef::new(NodeId::alloc()); // self.ctx.set_hir(id, self.ctx.sb.arenas.hir.subtype_ind.alloc(hir)); // Ok(Spanned::new(id, term.span)) }
Map a term to a subtype indication.
Map a term to a subtype indication .
&self
term
Spanned<Term>
&self
term
Spanned<Term>