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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
59c4b922
Commit
59c4b922
authored
Dec 07, 2016
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Type inference fixes.
parent
9a688de2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-4
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+3
-3
No files found.
Cython/Compiler/ExprNodes.py
View file @
59c4b922
...
...
@@ -4954,11 +4954,10 @@ class CallNode(ExprNode):
if
func_type
.
is_ptr
:
func_type
=
func_type
.
base_type
if
func_type
.
is_cfunction
:
if
hasattr
(
self
.
function
,
'entry
'
):
if
getattr
(
self
.
function
,
'entry'
,
None
)
and
hasattr
(
self
,
'args
'
):
alternatives
=
self
.
function
.
entry
.
all_alternatives
()
arg_types
=
[
arg
.
infer_type
(
env
)
for
arg
in
self
.
args
]
func_entry
=
PyrexTypes
.
best_match
(
arg_types
,
alternatives
,
None
,
env
)
func_entry
=
PyrexTypes
.
best_match
(
arg_types
,
alternatives
)
if
func_entry
:
func_type
=
func_entry
.
type
if
func_type
.
is_ptr
:
...
...
@@ -5185,7 +5184,7 @@ class SimpleCallNode(CallNode):
alternatives
=
overloaded_entry
.
all_alternatives
()
entry
=
PyrexTypes
.
best_match
(
[
arg
.
type
for
arg
in
args
],
alternatives
,
self
.
pos
,
env
)
[
arg
.
type
for
arg
in
args
],
alternatives
,
self
.
pos
,
env
,
args
)
if
not
entry
:
self
.
type
=
PyrexTypes
.
error_type
...
...
Cython/Compiler/PyrexTypes.py
View file @
59c4b922
...
...
@@ -4021,7 +4021,7 @@ def is_promotion(src_type, dst_type):
return
src_type
.
is_float
and
src_type
.
rank
<=
dst_type
.
rank
return
False
def
best_match
(
arg_types
,
functions
,
pos
=
None
,
env
=
None
):
def
best_match
(
arg_types
,
functions
,
pos
=
None
,
env
=
None
,
args
=
None
):
"""
Given a list args of arguments and a list of functions, choose one
to call which seems to be the "best" fit for this list of arguments.
...
...
@@ -4114,8 +4114,8 @@ def best_match(arg_types, functions, pos=None, env=None):
for
index
,
(
func
,
func_type
)
in
enumerate
(
candidates
):
score
=
[
0
,
0
,
0
,
0
]
for
i
in
range
(
min
(
len
(
args
)
,
len
(
func_type
.
args
))):
src_type
=
arg
s
[
i
].
type
for
i
in
range
(
min
(
actual_nargs
,
len
(
func_type
.
args
))):
src_type
=
arg
_types
[
i
]
dst_type
=
func_type
.
args
[
i
].
type
assignable
=
dst_type
.
assignable_from
(
src_type
)
...
...
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