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
67a2b9dc
Commit
67a2b9dc
authored
Jul 07, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add check that type is unboxed in annotation result
parent
8fc460f8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
trans/transpiler/phases/typing/common.py
trans/transpiler/phases/typing/common.py
+6
-3
No files found.
trans/transpiler/phases/typing/common.py
View file @
67a2b9dc
...
@@ -4,7 +4,7 @@ from typing import Dict, Optional
...
@@ -4,7 +4,7 @@ from typing import Dict, Optional
from
transpiler.phases.typing.annotations
import
TypeAnnotationVisitor
from
transpiler.phases.typing.annotations
import
TypeAnnotationVisitor
from
transpiler.phases.typing.scope
import
Scope
,
ScopeKind
,
VarDecl
from
transpiler.phases.typing.scope
import
Scope
,
ScopeKind
,
VarDecl
from
transpiler.phases.typing.types
import
BaseType
,
TypeVariable
,
TY_NONE
from
transpiler.phases.typing.types
import
BaseType
,
TypeVariable
,
TY_NONE
,
TypeType
from
transpiler.phases.utils
import
NodeVisitorSeq
from
transpiler.phases.utils
import
NodeVisitorSeq
PRELUDE
=
Scope
.
make_global
()
PRELUDE
=
Scope
.
make_global
()
...
@@ -19,7 +19,9 @@ class ScoperVisitor(NodeVisitorSeq):
...
@@ -19,7 +19,9 @@ class ScoperVisitor(NodeVisitorSeq):
return
TypeAnnotationVisitor
(
self
.
scope
,
self
.
cur_class
)
return
TypeAnnotationVisitor
(
self
.
scope
,
self
.
cur_class
)
def
visit_annotation
(
self
,
expr
:
Optional
[
ast
.
expr
])
->
BaseType
:
def
visit_annotation
(
self
,
expr
:
Optional
[
ast
.
expr
])
->
BaseType
:
return
self
.
anno
().
visit
(
expr
)
if
expr
else
TypeVariable
()
res
=
self
.
anno
().
visit
(
expr
)
if
expr
else
TypeVariable
()
assert
not
isinstance
(
res
,
TypeType
)
return
res
def
visit_block
(
self
,
block
:
list
[
ast
.
AST
]):
def
visit_block
(
self
,
block
:
list
[
ast
.
AST
]):
from
transpiler.phases.typing.block
import
ScoperBlockVisitor
from
transpiler.phases.typing.block
import
ScoperBlockVisitor
...
@@ -34,3 +36,4 @@ class ScoperVisitor(NodeVisitorSeq):
...
@@ -34,3 +36,4 @@ class ScoperVisitor(NodeVisitorSeq):
b
.
decls
=
decls
b
.
decls
=
decls
if
not
node
.
inner_scope
.
has_return
:
if
not
node
.
inner_scope
.
has_return
:
rtype
.
unify
(
TY_NONE
)
rtype
.
unify
(
TY_NONE
)
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