Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
f1dd801a
Commit
f1dd801a
authored
Aug 13, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Self substitution for generics
parent
aec0e5c2
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 @
f1dd801a
...
@@ -104,7 +104,7 @@ class ScoperExprVisitor(ScoperVisitor):
...
@@ -104,7 +104,7 @@ class ScoperExprVisitor(ScoperVisitor):
def
visit_Call
(
self
,
node
:
ast
.
Call
)
->
BaseType
:
def
visit_Call
(
self
,
node
:
ast
.
Call
)
->
BaseType
:
ftype
=
self
.
visit
(
node
.
func
)
ftype
=
self
.
visit
(
node
.
func
)
if
ftype
.
typevars
:
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
])
rtype
=
self
.
visit_function_call
(
ftype
,
[
self
.
visit
(
arg
)
for
arg
in
node
.
args
])
actual
=
rtype
actual
=
rtype
node
.
is_await
=
False
node
.
is_await
=
False
...
...
trans/transpiler/phases/typing/types.py
View file @
f1dd801a
...
@@ -345,8 +345,9 @@ class TypeType(TypeOperator):
...
@@ -345,8 +345,9 @@ class TypeType(TypeOperator):
TY_SELF
=
TypeOperator
.
make_type
(
"Self"
)
TY_SELF
=
TypeOperator
.
make_type
(
"Self"
)
def
self_gen_sub
(
this
,
typevars
,
_
):
def
self_gen_sub
(
this
,
typevars
,
_
):
assert
this
is
not
None
if
this
is
not
None
:
return
this
return
this
return
TY_SELF
TY_SELF
.
gen_sub
=
self_gen_sub
TY_SELF
.
gen_sub
=
self_gen_sub
TY_BOOL
=
TypeOperator
.
make_type
(
"bool"
)
TY_BOOL
=
TypeOperator
.
make_type
(
"bool"
)
DEFAULT_EQ
=
FunctionType
([
TY_SELF
,
TY_SELF
],
TY_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