1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#![allow(unused_variables)]
#![allow(unused_imports)]
use num::BigInt;
use crate::hir::prelude::*;
use crate::hir::{EnumLit, ExprContext, Range2};
use crate::term::{self, Term, TermContext};
use crate::ty2::{
AnyType, EnumBasetype, EnumVariant, FloatingBasetype, IntegerBasetype, IntegerRange,
PhysicalBasetype, PhysicalUnit, Range, UniversalIntegerType,
};
#[derive(Debug)]
pub struct SubtypeDecl2<'t> {
span: Span,
name: Spanned<Name>,
data: Spanned<&'t Slot<'t, SubtypeInd2<'t>>>,
}
#[derive(Debug)]
pub struct SubtypeInd2<'t> {
span: Span,
marker: &'t (),
}
impl<'t> SubtypeInd2<'t> {
pub fn declared_type<C>(&self, ctx: C) -> Result<&'t Type>
where
C: ExprContext<'t> + Copy,
{
unimplemented!("declared_type of a subtype indication")
}
}
impl<'t> FromAst<'t> for SubtypeInd2<'t> {
type AllocInput = &'t ast::SubtypeInd;
type LatentInput = Self::AllocInput;
type Context = AllocContext<'t>;
type Latent = &'t Slot<'t, Self>;
fn alloc_slot(ast: Self::AllocInput, context: Self::Context) -> Result<Self::Latent> {
let slot = context.alloc(Slot::new(ast, context));
Ok(slot)
}
fn from_ast(ast: Self::LatentInput, context: Self::Context) -> Result<Self> {
Ok(SubtypeInd2 {
span: ast.span,
marker: &(),
})
}
}
impl<'t> Node<'t> for SubtypeInd2<'t> {
fn span(&self) -> Span {
self.span
}
fn desc_kind(&self) -> String {
"subtype indication".into()
}
fn desc_name(&self) -> String {
self.desc_kind()
}
fn accept(&'t self, visitor: &mut Visitor<'t>) {
visitor.visit_subtype_ind(self);
}
fn walk(&'t self, visitor: &mut Visitor<'t>) {}
}