Commit bd6a80ee authored by Robert Bradshaw's avatar Robert Bradshaw

Fix ticket #98, better error reporting on bad types.

parent aa3dfd5f
...@@ -1313,6 +1313,8 @@ def c_array_type(base_type, size): ...@@ -1313,6 +1313,8 @@ def c_array_type(base_type, size):
# Construct a C array type. # Construct a C array type.
if base_type is c_char_type: if base_type is c_char_type:
return CCharArrayType(size) return CCharArrayType(size)
elif base_type is error_type:
return error_type
else: else:
return CArrayType(base_type, size) return CArrayType(base_type, size)
...@@ -1320,6 +1322,8 @@ def c_ptr_type(base_type): ...@@ -1320,6 +1322,8 @@ def c_ptr_type(base_type):
# Construct a C pointer type. # Construct a C pointer type.
if base_type is c_char_type: if base_type is c_char_type:
return c_char_ptr_type return c_char_ptr_type
elif base_type is error_type:
return error_type
else: else:
return CPtrType(base_type) return CPtrType(base_type)
......
...@@ -19,6 +19,9 @@ cdef f(Grail g, # incomplete argument type ...@@ -19,6 +19,9 @@ cdef f(Grail g, # incomplete argument type
void v, # incomplete argument type void v, # incomplete argument type
int a[]): int a[]):
pass pass
cdef NoSuchType* ptr
ptr = None # This should not produce another error
_ERRORS = u""" _ERRORS = u"""
3:19: Python object cannot be declared extern 3:19: Python object cannot be declared extern
...@@ -35,4 +38,5 @@ _ERRORS = u""" ...@@ -35,4 +38,5 @@ _ERRORS = u"""
19:1: Use spam() rather than spam(void) to declare a function with no arguments. 19:1: Use spam() rather than spam(void) to declare a function with no arguments.
18:7: Argument type 'Grail' is incomplete 18:7: Argument type 'Grail' is incomplete
19:1: Invalid use of 'void' 19:1: Invalid use of 'void'
23:5: 'NoSuchType' is not a type identifier
""" """
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment