mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-02 21:44:34 +00:00
feat: add Record.as_dict()
This commit is contained in:
parent
2966497ad6
commit
5e71bd7fd0
6 changed files with 96 additions and 4 deletions
|
@ -2424,12 +2424,12 @@ impl Context {
|
|||
Type::Poly { name, .. } => {
|
||||
return self.get_poly_type(name);
|
||||
}
|
||||
Type::Record(rec) if rec.values().all(|attr| self.supertype_of(&Type, attr)) => {
|
||||
/*Type::Record(rec) if rec.values().all(|attr| self.supertype_of(&Type, attr)) => {
|
||||
return self
|
||||
.get_builtins()
|
||||
.unwrap_or(self)
|
||||
.rec_local_get_mono_type("RecordType");
|
||||
}
|
||||
}*/
|
||||
Type::Record(_) => {
|
||||
return self
|
||||
.get_builtins()
|
||||
|
@ -3149,6 +3149,11 @@ impl Context {
|
|||
.map(|(name, tp)| (name.clone(), self.meta_type(tp)))
|
||||
.collect(),
|
||||
),
|
||||
Record(rec) => Record(
|
||||
rec.iter()
|
||||
.map(|(name, tp)| (name.clone(), self.meta_type(tp)))
|
||||
.collect(),
|
||||
),
|
||||
_ => Type,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue