use crate::ast::PrimitiveType;
use crate::lexer::Span;
use std::collections::HashMap;
#[derive(Debug, Clone, PartialEq)]
pub enum SymbolKind {
Function,
Variable,
Class,
Interface,
Enum,
Constant,
Import,
Type, }
#[derive(Debug, Clone, PartialEq)]
pub struct Symbol {
pub kind: SymbolKind,
pub span: Span,
pub type_: Option<Type>,
pub interfaces: HashMap<String, (Vec<Type>, HashMap<String, MethodSig>)>,
pub methods: HashMap<String, MethodSig>,
pub fields: HashMap<String, (Type, bool)>, pub type_params: Vec<(String, Vec<String>)>,
pub original_name: Option<String>, pub llvm_name: Option<String>, pub default_param_count: usize, pub variants: Option<Vec<String>>, }
#[derive(Debug, Clone, PartialEq)]
pub enum Type {
Primitive(PrimitiveType),
List(Box<Type>),
Map(Box<Type>, Box<Type>),
Set(Box<Type>),
Tuple(Box<Type>, Box<Type>),
Optional(Box<Type>),
Result(Box<Type>, Box<Type>),
Reference(Box<Type>),
Void,
Never,
EmptyList,
EmptyMap,
EmptySet,
Function {
params: Vec<Type>,
returns: Box<Type>,
default_count: usize, },
Named(String, Vec<Type>),
Variable(String),
Generic(String), #[allow(dead_code)]
Instantiated(String, Vec<Type>), Module(String), }
#[derive(Debug, Clone)]
pub struct GenericContext {
pub type_params: HashMap<String, Type>, }
#[derive(Debug, Clone, PartialEq)]
pub struct MethodSig {
pub params: Vec<Type>,
pub return_type: Type,
pub is_static: bool,
}
#[derive(Debug, Clone, PartialEq)]
pub struct BuiltInSig {
pub params: Vec<Type>,
pub return_type: Type,
}