Even more deletions

This commit is contained in:
greg 2018-05-16 01:08:06 -07:00
parent f48a25779c
commit 36cd7e080d
2 changed files with 7 additions and 15 deletions

View File

@ -1,8 +1,8 @@
use std::rc::Rc; use std::rc::Rc;
use std::collections::HashMap; use std::collections::HashMap;
use typechecking::{Type, TypeResult, TConst}; use typechecking::{Type, TypeResult, TConstOld};
use self::Type::*; use self::TConst::*; use self::Type::*; use self::TConstOld::*;
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]
pub struct BinOp { pub struct BinOp {

View File

@ -9,7 +9,6 @@ use itertools::Itertools;
use parsing; use parsing;
pub struct TypeContext { pub struct TypeContext {
//type_var_count: u64,
bindings: HashMap<Rc<String>, Type>, bindings: HashMap<Rc<String>, Type>,
pub symbol_table: SymbolTable pub symbol_table: SymbolTable
} }
@ -42,21 +41,12 @@ pub enum SymbolSpec {
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]
pub enum Type { pub enum Type {
Const(TConst), Const(TConstOld),
Var(TVar),
Func(Box<Type>, Box<Type>), Func(Box<Type>, Box<Type>),
//UVar(String),
//EVar(u64),
Sum(Vec<Type>),
Void
} }
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]
pub struct TVar(String); pub enum TConstOld {
#[derive(Debug, PartialEq, Clone)]
pub enum TConst {
Unit,
Nat, Nat,
Int, Int,
Float, Float,
@ -77,16 +67,18 @@ impl parsing::TypeName {
fn to_type(&self) -> TypeResult<Type> { fn to_type(&self) -> TypeResult<Type> {
use self::parsing::TypeSingletonName; use self::parsing::TypeSingletonName;
use self::parsing::TypeName::*; use self::parsing::TypeName::*;
use self::Type::*; use self::TConst::*; use self::Type::*; use self::TConstOld::*;
Ok(match self { Ok(match self {
Tuple(_) => return Err(format!("Tuples not yet implemented")), Tuple(_) => return Err(format!("Tuples not yet implemented")),
Singleton(name) => match name { Singleton(name) => match name {
TypeSingletonName { name, .. } => match &name[..] { TypeSingletonName { name, .. } => match &name[..] {
/*
"Nat" => Const(Nat), "Nat" => Const(Nat),
"Int" => Const(Int), "Int" => Const(Int),
"Float" => Const(Float), "Float" => Const(Float),
"Bool" => Const(Bool), "Bool" => Const(Bool),
"String" => Const(StringT), "String" => Const(StringT),
*/
n => Const(Custom(n.to_string())) n => Const(Custom(n.to_string()))
} }
} }