Add type specification for array and range types

This commit is contained in:
Shunsuke Shibayama 2022-09-28 00:05:23 +09:00
parent f6637f0f51
commit f548f9e6ef
4 changed files with 58 additions and 3 deletions

View file

@ -1586,6 +1586,15 @@ impl fmt::Display for ArrayTypeSpec {
impl_locational!(ArrayTypeSpec, ty, len);
impl ArrayTypeSpec {
pub fn new(ty: TypeSpec, len: ConstExpr) -> Self {
Self {
ty: Box::new(ty),
len,
}
}
}
/// * Array: `[Int; 3]`, `[Int, Ratio, Complex]`, etc.
/// * Dict: `[Str: Str]`, etc.
/// * And (Intersection type): Add and Sub and Mul (== Num), etc.