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
Xavier Thompson
cython
Commits
afdf8cde
Commit
afdf8cde
authored
Dec 29, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit test for 'iso' aliasing errors
parent
5e7b7c0d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
+92
-0
tests/errors/cypclass_iso_errors.pyx
tests/errors/cypclass_iso_errors.pyx
+92
-0
No files found.
tests/errors/cypclass_iso_errors.pyx
0 → 100644
View file @
afdf8cde
# mode: error
# tag: cpp, cpp11, pthread
# cython: experimental_cpp_class_def=True, language_level=2
cdef
cypclass
A
activable
:
pass
def
test_name_aliasing
():
cdef
iso
A
iso_a
iso_a
=
consume
A
()
# Aliasing non-consumed to iso
cdef
iso
A
iso_b
iso_b
=
iso_a
cdef
iso
A
iso_c
iso_c
=
A
()
cdef
iso
A
iso_d
iso_d
=
activate
(
consume
A
())
cdef
iso
A
iso_e
iso_e
=
<
object
>
A
()
# Aliasing iso
cdef
iso
A
iso_f
iso_f
=
iso_a
cdef
active
A
active_a
active_a
=
iso_a
cdef
A
ref_a
ref_a
=
iso_a
cdef
object
py_a
py_a
=
iso_a
cdef
cypclass
Field
:
Field
foo
(
self
,
Field
other
):
return
other
cdef
cypclass
Origin
:
Field
field
__init__
(
self
):
self
.
field
=
Field
()
Field
bar
(
self
,
Field
other
):
return
other
def
test_field_aliasing
():
cdef
iso
Origin
o
=
consume
Origin
()
cdef
object
py_field
# OK - can pass consumed arguments
o
.
bar
(
consume
Field
()).
foo
(
consume
Field
())
# ERR - aliasing field of iso to pyobject
py_field
=
o
.
field
# ERR - pyobject to field of iso
o
.
field
=
py_field
# ERR - aliasing field of iso
field
=
o
.
field
# ERR - consuming field of iso
field2
=
consume
o
.
field
# ERR - non_consumed argument
o
.
bar
(
Field
())
# ERR - aliasing the returned reference
c
=
o
.
bar
(
consume
Field
())
_ERRORS
=
u'''
14:12: Cannot assign type 'iso A' to 'iso A'
17:13: Cannot assign type 'A' to 'iso A'
20:20: Cannot assign type 'active A' to 'iso A'
23:12: Cannot convert Python object to 'iso A'
27:12: Cannot assign type 'iso A' to 'iso A'
30:15: Cannot assign type 'iso A' to 'active A'
33:12: Cannot assign type 'iso A' to 'A'
36:11: Cannot convert 'iso A' to Python object
60:16: Cannot convert 'iso-> Field' to Python object
63:14: Cannot convert Python object to 'iso-> Field'
66:13: Cannot assign type 'iso-> Field' to 'iso-> Field'
72:15: Cannot assign type 'Field' to 'iso-> Field'
75:13: Cannot assign type 'iso-> Field' to 'iso-> Field'
'''
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