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
968bedc0
Commit
968bedc0
authored
Sep 04, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some Python unification problems
parent
551ba3cc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
trans/tests/a_a_call_py_1.py
trans/tests/a_a_call_py_1.py
+0
-0
trans/transpiler/phases/emit_cpp/module.py
trans/transpiler/phases/emit_cpp/module.py
+2
-2
trans/transpiler/phases/typing/expr.py
trans/transpiler/phases/typing/expr.py
+7
-3
No files found.
trans/tests/call_py_1.py
→
trans/tests/
a_a_
call_py_1.py
View file @
968bedc0
File moved
trans/transpiler/phases/emit_cpp/module.py
View file @
968bedc0
...
...
@@ -76,8 +76,8 @@ class ModuleVisitor(BlockVisitor):
yield
""
elif
node
.
module_obj
.
is_python
:
for
alias
in
node
.
names
:
fty
=
alias
.
item_obj
assert
isinstance
(
fty
,
FunctionType
)
fty
=
alias
.
item_obj
.
resolve
()
#
assert isinstance(fty, FunctionType)
yield
from
self
.
emit_python_func
(
node
.
module
,
alias
.
name
,
alias
.
asname
or
alias
.
name
,
fty
)
else
:
...
...
trans/transpiler/phases/typing/expr.py
View file @
968bedc0
...
...
@@ -131,14 +131,18 @@ class ScoperExprVisitor(ScoperVisitor):
init
:
FunctionType
=
self
.
visit_getattr
(
ftype
,
"__init__"
).
remove_self
()
init
.
return_type
=
ftype
.
type_object
return
self
.
visit_function_call
(
init
,
arguments
)
if
not
isinstance
(
ftype
,
FunctionType
):
if
isinstance
(
ftype
,
FunctionType
):
ret
=
ftype
.
return_type
elif
isinstance
(
ftype
,
TypeVariable
):
ret
=
TypeVariable
()
else
:
from
transpiler.phases.typing.exceptions
import
NotCallableError
raise
NotCallableError
(
ftype
)
#is_generic = any(isinstance(arg, TypeVariable) for arg in ftype.to_list())
equivalent
=
FunctionType
(
arguments
,
ftype
.
return_type
)
equivalent
=
FunctionType
(
arguments
,
ret
)
equivalent
.
is_intermediary
=
True
ftype
.
unify
(
equivalent
)
return
ftype
.
return_type
return
equivalent
.
return_type
def
visit_Lambda
(
self
,
node
:
ast
.
Lambda
)
->
BaseType
:
argtypes
=
[
TypeVariable
()
for
_
in
node
.
args
.
args
]
...
...
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