Skip to content

Commit

Permalink
feat: add typing APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Aug 13, 2024
1 parent b75325d commit 0a040f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/erg_compiler/context/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1838,6 +1838,9 @@ impl Context {
self.level,
);
for sup in super_classes.into_iter() {
if sup.is_failure() {
continue;
}
let sup_ctx = match self.get_nominal_type_ctx(&sup).ok_or_else(|| {
TyCheckErrors::from(TyCheckError::type_not_found(
self.cfg.input.clone(),
Expand Down
8 changes: 8 additions & 0 deletions crates/erg_compiler/lib/pystd/typing.d.er
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,19 @@
.assert_never: (arg: Obj) -> NoneType
.assert_type: (val: Obj, typ: Type) -> NoneType
.cast: |T|(typ: {T}, val: Obj) -> T
.clear_overloads!: () => NoneType
.final: |C <: GenericCallable or Type|(func_or_type: C) -> C
.get_args: (type: Type) -> [Type; _]
.get_type_hints: (obj: Obj, globalns: {Str: Obj}, localns: {Str: Obj}) -> {Str: Obj}
.get_origin: (type: Type) -> Type
.get_overloads: (func: GenericCallable) -> [Obj; _]
.is_typeddict: (type: Type) -> Bool
.no_type_check: |C <: GenericCallable|(func: C) -> C
.no_type_check_decorator: |C <: GenericCallable|(func: C) -> C
.overload: |C <: GenericCallable|(func: C) -> C
.override: |C <: GenericCallable|(func: C) -> C
.reveal_type: (obj: Obj) -> NoneType
.type_check_only: |C <: GenericCallable|(func: C) -> C

.AbstractSet: ClassType
.AbstractSet.
Expand Down

0 comments on commit 0a040f1

Please sign in to comment.