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
8fd5e9fb
Commit
8fd5e9fb
authored
Feb 07, 2024
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
thing
parent
95b8479f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
typon/trans/stdlib/builtins_.py
typon/trans/stdlib/builtins_.py
+4
-1
typon/trans/transpiler/phases/typing/expr.py
typon/trans/transpiler/phases/typing/expr.py
+2
-2
typon/trans/transpiler/phases/typing/types.py
typon/trans/transpiler/phases/typing/types.py
+1
-1
No files found.
typon/trans/stdlib/builtins_.py
View file @
8fd5e9fb
...
...
@@ -59,6 +59,7 @@ class str:
def
__contains__
(
self
,
item
:
Self
)
->
bool
:
...
assert
len
(
"a"
)
assert
not
len
(
6
)
class
bytes
:
def
decode
(
self
,
encoding
:
str
)
->
str
:
...
...
...
@@ -172,4 +173,6 @@ assert not __test_type().test_opt()
def
exit
(
code
:
int
|
None
=
None
)
->
None
:
...
class
Exception
:
def
__init__
(
self
,
message
:
str
)
->
None
:
...
\ No newline at end of file
def
__init__
(
self
,
message
:
str
)
->
None
:
...
assert
next
([])
\ No newline at end of file
typon/trans/transpiler/phases/typing/expr.py
View file @
8fd5e9fb
...
...
@@ -8,7 +8,7 @@ from transpiler.phases.typing.common import ScoperVisitor, get_iter, get_next, i
from
transpiler.phases.typing.exceptions
import
ArgumentCountMismatchError
,
TypeMismatchKind
,
TypeMismatchError
from
transpiler.phases.typing.types
import
BaseType
,
TY_STR
,
TY_BOOL
,
TY_INT
,
TY_COMPLEX
,
TY_FLOAT
,
TY_NONE
,
\
ClassTypeType
,
ResolvedConcreteType
,
GenericType
,
CallableInstanceType
,
TY_LIST
,
TY_SET
,
TY_DICT
,
RuntimeValue
,
\
TypeVariable
,
TY_LAMBDA
,
TypeListType
,
MethodType
TypeVariable
,
TY_LAMBDA
,
TypeListType
,
MethodType
,
TY_TUPLE
from
transpiler.phases.typing.scope
import
ScopeKind
,
VarDecl
,
VarKind
from
transpiler.utils
import
linenodata
...
...
@@ -52,7 +52,7 @@ class ScoperExprVisitor(ScoperVisitor):
return
res
def
visit_Tuple
(
self
,
node
:
ast
.
Tuple
)
->
BaseType
:
return
T
upleType
(
*
[
self
.
visit
(
e
)
for
e
in
node
.
elts
])
return
T
Y_TUPLE
.
instantiate_
(
*
[
self
.
visit
(
e
)
for
e
in
node
.
elts
])
def
visit_Slice
(
self
,
node
:
ast
.
Slice
)
->
BaseType
:
for
n
in
(
"lower"
,
"upper"
,
"step"
):
...
...
typon/trans/transpiler/phases/typing/types.py
View file @
8fd5e9fb
...
...
@@ -501,7 +501,7 @@ class CallableInstanceType(GenericInstanceType, MethodType):
)
def
__str__
(
self
):
return
f"(
{
", "
.
join
(
map
(
str
,
self
.
parameters
+
([
"
,
*args"
]
if
self
.
is_variadic
else
[])))
}
) ->
{
self
.
return_type
}
"
return
f"(
{
", "
.
join
(
map
(
str
,
self
.
parameters
+
([
"*args"
]
if
self
.
is_variadic
else
[])))
}
) ->
{
self
.
return_type
}
"
def
try_assign_internal
(
self
,
other
:
BaseType
)
->
bool
:
if
not
isinstance
(
other
,
CallableInstanceType
):
...
...
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