Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tom Niget
typon
Commits
c5aae2f9
Commit
c5aae2f9
authored
Aug 13, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Self substitution for generics
parent
30dc6b3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
trans/transpiler/phases/typing/expr.py
trans/transpiler/phases/typing/expr.py
+1
-1
trans/transpiler/phases/typing/types.py
trans/transpiler/phases/typing/types.py
+3
-2
No files found.
trans/transpiler/phases/typing/expr.py
View file @
c5aae2f9
...
...
@@ -104,7 +104,7 @@ class ScoperExprVisitor(ScoperVisitor):
def
visit_Call
(
self
,
node
:
ast
.
Call
)
->
BaseType
:
ftype
=
self
.
visit
(
node
.
func
)
if
ftype
.
typevars
:
ftype
=
ftype
.
gen_sub
(
ftyp
e
,
{
v
.
name
:
TypeVariable
(
v
.
name
)
for
v
in
ftype
.
typevars
})
ftype
=
ftype
.
gen_sub
(
Non
e
,
{
v
.
name
:
TypeVariable
(
v
.
name
)
for
v
in
ftype
.
typevars
})
rtype
=
self
.
visit_function_call
(
ftype
,
[
self
.
visit
(
arg
)
for
arg
in
node
.
args
])
actual
=
rtype
node
.
is_await
=
False
...
...
trans/transpiler/phases/typing/types.py
View file @
c5aae2f9
...
...
@@ -345,8 +345,9 @@ class TypeType(TypeOperator):
TY_SELF
=
TypeOperator
.
make_type
(
"Self"
)
def
self_gen_sub
(
this
,
typevars
,
_
):
assert
this
is
not
None
return
this
if
this
is
not
None
:
return
this
return
TY_SELF
TY_SELF
.
gen_sub
=
self_gen_sub
TY_BOOL
=
TypeOperator
.
make_type
(
"bool"
)
DEFAULT_EQ
=
FunctionType
([
TY_SELF
,
TY_SELF
],
TY_BOOL
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment