Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
aba4d55b
Commit
aba4d55b
authored
May 23, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue errors for fused types declarations at module level or cdef class scope
parent
b69b4a5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
13 deletions
+30
-13
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+4
-0
tests/errors/fused_types.pyx
tests/errors/fused_types.pyx
+26
-13
No files found.
Cython/Compiler/Nodes.py
View file @
aba4d55b
...
@@ -1074,6 +1074,10 @@ class CVarDefNode(StatNode):
...
@@ -1074,6 +1074,10 @@ class CVarDefNode(StatNode):
self
.
dest_scope
=
dest_scope
self
.
dest_scope
=
dest_scope
base_type
=
self
.
base_type
.
analyse
(
env
)
base_type
=
self
.
base_type
.
analyse
(
env
)
if
base_type
.
is_fused
and
(
env
.
is_c_class_scope
or
env
.
is_module_scope
):
error
(
self
.
pos
,
"Fused types not allowed here"
)
return
error_type
self
.
entry
=
None
self
.
entry
=
None
visibility
=
self
.
visibility
visibility
=
self
.
visibility
...
...
tests/errors/fused_types.pyx
View file @
aba4d55b
...
@@ -38,6 +38,16 @@ def f(memslice_dtype_t[:, :] a):
...
@@ -38,6 +38,16 @@ def f(memslice_dtype_t[:, :] a):
lambda
cython
.
integral
i
:
i
lambda
cython
.
integral
i
:
i
cdef
cython
.
floating
x
cdef
class
Foo
(
object
):
cdef
cython
.
floating
attr
def
outer
(
cython
.
floating
f
):
def
inner
():
cdef
cython
.
floating
g
# This is all valid
# This is all valid
dtype5
=
fused_type
(
int
,
long
,
float
)
dtype5
=
fused_type
(
int
,
long
,
float
)
dtype6
=
cython
.
fused_type
(
int
,
long
)
dtype6
=
cython
.
fused_type
(
int
,
long
)
...
@@ -53,18 +63,21 @@ ctypedef fused fused2:
...
@@ -53,18 +63,21 @@ ctypedef fused fused2:
func
(
x
,
y
)
func
(
x
,
y
)
_ERRORS
=
u"""
_ERRORS
=
u"""
fused_types.pyx:10:15: fused_type does not take keyword arguments
10:15: fused_type does not take keyword arguments
fused_types.pyx:15:38: Type specified multiple times
15:38: Type specified multiple times
fused_types.pyx:17:33: Cannot fuse a fused type
17:33: Cannot fuse a fused type
fused_types.pyx:26:4: Invalid use of fused types, type cannot be specialized
26:4: Invalid use of fused types, type cannot be specialized
fused_types.pyx:26:4: Not enough types specified to specialize the function, int2_t is still fused
26:4: Not enough types specified to specialize the function, int2_t is still fused
fused_types.pyx:27:4: Invalid use of fused types, type cannot be specialized
27:4: Invalid use of fused types, type cannot be specialized
fused_types.pyx:27:4: Not enough types specified to specialize the function, int2_t is still fused
27:4: Not enough types specified to specialize the function, int2_t is still fused
fused_types.pyx:28:16: Call with wrong number of arguments (expected 2, got 1)
28:16: Call with wrong number of arguments (expected 2, got 1)
fused_types.pyx:29:16: Call with wrong number of arguments (expected 2, got 3)
29:16: Call with wrong number of arguments (expected 2, got 3)
fused_types.pyx:30:4: Invalid use of fused types, type cannot be specialized
30:4: Invalid use of fused types, type cannot be specialized
fused_types.pyx:30:4: Keyword and starred arguments not allowed in cdef functions.
30:4: Keyword and starred arguments not allowed in cdef functions.
fused_types.pyx:36:6: Invalid base type for memoryview slice: int *
36:6: Invalid base type for memoryview slice: int *
fused_types.pyx:39:0: Fused lambdas not allowed
39:0: Fused lambdas not allowed
42:5: Fused types not allowed here
45:9: Fused types not allowed here
"""
"""
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