length.check (context);
if (length.value_type == null || !(length.value_type is IntegerType) || !length.is_constant ()) {
+ error = true;
Report.error (length.source_reference, "Expression of constant integer type expected");
return false;
}
}
if (element_type is ArrayType) {
+ error = true;
Report.error (source_reference, "Stacked arrays are not supported");
return false;
} else if (element_type is DelegateType) {
var delegate_type = (DelegateType) element_type;
if (delegate_type.delegate_symbol.has_target) {
+ error = true;
Report.error (source_reference, "Delegates with target are not supported as array element type");
return false;
}
&& context.analyzer.find_current_method () is CreationMethod) {
if (ma.inner.symbol_reference != context.analyzer.find_current_method ().this_parameter) {
// trying to set construct-only property in creation method for foreign instance
+ error = true;
Report.error (ma.source_reference, "Property `%s' is read-only".printf (prop.get_full_name ()));
return false;
} else {
+ error = true;
Report.error (ma.source_reference, "Cannot assign to construct-only properties, use Object (property: value) constructor chain up");
return false;
}
right.target_type.nullable = false;
} else if (right.value_type is ArrayType) {
if (!left.value_type.compatible (((ArrayType) right.value_type).element_type)) {
+ error = true;
Report.error (source_reference, "Cannot look for `%s' in `%s'".printf (left.value_type.to_string (), right.value_type.to_string ()));
}
} else {
// GVariant unboxing returns owned value
value_type.value_owned = true;
if (value_type.get_type_signature () == null) {
+ error = true;
Report.error (source_reference, "Casting of `GLib.Variant' to `%s' is not supported".printf (value_type.to_qualified_string ()));
}
}
context.analyzer.current_symbol = old_symbol;
if (is_abstract || is_virtual || overrides) {
+ error = true;
Report.error (source_reference, "The creation method `%s' cannot be marked as override, virtual, or abstract".printf (get_full_name ()));
return false;
}
checked = true;
- declaration.check (context);
+ if (!declaration.check (context)) {
+ // ignore inner error
+ error = true;
+ return false;
+ }
return !error;
}
var n_type_params = delegate_symbol.get_type_parameters ().size;
var n_type_args = get_type_arguments ().size;
if (n_type_args > 0 && n_type_args < n_type_params) {
+ error = true;
Report.error (source_reference, "too few type arguments");
return false;
} else if (n_type_args > 0 && n_type_args > n_type_params) {
+ error = true;
Report.error (source_reference, "too many type arguments");
return false;
}
foreach (DataType type in get_type_arguments ()) {
if (!type.check (context)) {
+ error = true;
return false;
}
}
if (!expression.check (context)) {
// if there was an error in the inner expression, skip this check
+ error = true;
return false;
}
if (variable_array_type != null && variable_array_type.inline_allocated
&& variable_array_type.length == null && !(initializer is ArrayCreationExpression)) {
+ error = true;
Report.error (source_reference, "Inline allocated array requires either a given length or an initializer");
}
}
if (is_abstract && body != null) {
+ error = true;
Report.error (source_reference, "Abstract methods cannot have bodies");
} else if ((is_abstract || is_virtual) && is_extern) {
+ error = true;
Report.error (source_reference, "Extern methods cannot be abstract or virtual");
} else if (is_extern && body != null) {
+ error = true;
Report.error (source_reference, "Extern methods cannot have bodies");
} else if (!is_abstract && !external && source_type == SourceFileType.SOURCE && body == null) {
+ error = true;
Report.error (source_reference, "Non-abstract, non-extern methods must have bodies");
}
// Add local variable to provide access to params arrays which will be constructed out of the given va-args
if (param.params_array && body != null) {
if (params_array_var != null) {
+ error = true;
Report.error (param.source_reference, "Only one params-array parameter is allowed");
continue;
}
type.element_type.value_owned = type.value_owned;
type.value_owned = true;
if (type.element_type.is_real_struct_type () && !type.element_type.nullable) {
+ error = true;
Report.error (param.source_reference, "Only nullable struct elements are supported in params-array");
}
if (type.length != null) {
+ error = true;
Report.error (param.source_reference, "Passing length to params-array is not supported yet");
}
params_array_var = new LocalVariable (type, param.name, null, param.source_reference);
context.entry_point = this;
if (tree_can_fail) {
+ error = true;
Report.error (source_reference, "\"main\" method cannot throw errors");
}
if (is_inline) {
+ error = true;
Report.error (source_reference, "\"main\" method cannot be inline");
}
if (coroutine) {
+ error = true;
Report.error (source_reference, "\"main\" method cannot be async");
}
}
int n_type_args = get_type_arguments ().size;
if (n_type_args > 0 && n_type_args < object_type_symbol.get_type_parameters ().size) {
+ error = true;
Report.error (source_reference, "too few type arguments");
return false;
} else if (n_type_args > 0 && n_type_args > object_type_symbol.get_type_parameters ().size) {
+ error = true;
Report.error (source_reference, "too many type arguments");
return false;
}
unowned ArrayType? variable_array_type = variable_type as ArrayType;
if (variable_array_type != null && variable_array_type.inline_allocated
&& !variable_array_type.fixed_length) {
+ error = true;
Report.error (source_reference, "Inline allocated array as parameter requires to have fixed length");
}
}
&& direction != ParameterDirection.OUT) {
Report.warning (source_reference, "`null' incompatible with parameter type `%s'".printf (variable_type.to_string ()));
} else if (!(initializer is NullLiteral) && direction == ParameterDirection.OUT) {
+ error = true;
Report.error (source_reference, "only `null' is allowed as default value for out parameters");
} else if (direction == ParameterDirection.IN && !initializer.value_type.compatible (variable_type)) {
+ error = true;
Report.error (initializer.source_reference, "Cannot convert from `%s' to `%s'".printf (initializer.value_type.to_string (), variable_type.to_string ()));
} else if (direction == ParameterDirection.REF) {
+ error = true;
Report.error (source_reference, "default value not allowed for ref parameter");
} else if (!initializer.is_accessible (this)) {
+ error = true;
Report.error (initializer.source_reference, "default value is less accessible than method `%s'".printf (parent_symbol.get_full_name ()));
}
}
if (source_reference == null || source_reference.file == null) {
// Hopefully good as is
} else if (!value_type.value_owned && source_reference.file.file_type == SourceFileType.SOURCE) {
+ error = true;
Report.error (source_reference, "unowned return value for getter of property `%s' not supported without accessor".printf (prop.get_full_name ()));
}
} else if (value_type.value_owned && (source_reference == null || source_reference.file == null)) {
}
if (!is_virtual && body != null) {
+ error = true;
Report.error (source_reference, "Only virtual signals can have a default signal handler body");
}