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
316e4d8b
Commit
316e4d8b
authored
Jan 10, 2024
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some generic things
parent
e84a9530
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
12 deletions
+10
-12
typon/trans/tests/user_generics.py
typon/trans/tests/user_generics.py
+6
-0
typon/trans/tests/webserver.py
typon/trans/tests/webserver.py
+1
-5
typon/trans/tests/webserver_eval.py
typon/trans/tests/webserver_eval.py
+1
-5
typon/trans/transpiler/phases/emit_cpp/expr.py
typon/trans/transpiler/phases/emit_cpp/expr.py
+1
-1
typon/trans/transpiler/phases/typing/block.py
typon/trans/transpiler/phases/typing/block.py
+1
-1
No files found.
typon/trans/tests/user_generics.py
View file @
316e4d8b
...
...
@@ -11,6 +11,12 @@ class Thing(Generic[T]):
x
:
T
def
f
(
x
:
T
):
pass
if
__name__
==
"__main__"
:
a
=
Thing
[
int
](
1
)
b
=
Thing
[
str
](
"abc"
)
...
...
typon/trans/tests/webserver.py
View file @
316e4d8b
...
...
@@ -43,10 +43,6 @@ def server_loop(sockfd, filepath):
fork
(
lambda
:
handle_connection
(
connfd
,
filepath
))
def
server_loops
(
sockfd
,
filepath
):
for
i
in
range
(
20
):
fork
(
lambda
:
server_loop
(
sockfd
,
filepath
))
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
>
2
:
print
(
"Usage: webserver [ filepath ]"
)
...
...
@@ -57,4 +53,4 @@ if __name__ == "__main__":
sockfd
=
create_listening_socket
(
PORT
)
server_loops
(
sockfd
,
filepath
)
\ No newline at end of file
server_loop
(
sockfd
,
filepath
)
\ No newline at end of file
typon/trans/tests/webserver_eval.py
View file @
316e4d8b
...
...
@@ -43,14 +43,10 @@ def server_loop(sockfd):
fork
(
lambda
:
handle_connection
(
connfd
))
def
server_loops
(
sockfd
):
for
i
in
range
(
20
):
fork
(
lambda
:
server_loop
(
sockfd
))
if
__name__
==
"__main__"
:
print
(
"Serving on port"
,
PORT
)
print
()
sockfd
=
create_listening_socket
(
PORT
)
server_loop
s
(
sockfd
)
server_loop
(
sockfd
)
typon/trans/transpiler/phases/emit_cpp/expr.py
View file @
316e4d8b
...
...
@@ -278,7 +278,7 @@ class ExpressionVisitor(NodeVisitor):
yield
"{}"
def
visit_Subscript
(
self
,
node
:
ast
.
Subscript
)
->
Iterable
[
str
]:
if
isinstance
(
node
.
type
.
type_object
,
MonomorphizedUserType
):
if
isinstance
(
node
.
type
,
TypeType
)
and
isinstance
(
node
.
type
.
type_object
,
MonomorphizedUserType
):
yield
node
.
type
.
type_object
.
name
return
yield
from
self
.
prec
(
"[]"
).
visit
(
node
.
value
)
...
...
typon/trans/transpiler/phases/typing/block.py
View file @
316e4d8b
...
...
@@ -280,7 +280,7 @@ class ScoperBlockVisitor(ScoperVisitor):
else
:
# not generic
ctype
=
self
.
process_class_ast
(
UserType
(
node
.
name
),
node
,
bases_after
)
cttype
=
TypeType
(
OurGenericT
ype
)
cttype
=
TypeType
(
ct
ype
)
self
.
scope
.
vars
[
node
.
name
]
=
VarDecl
(
VarKind
.
LOCAL
,
cttype
)
...
...
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