parent
46c357df7b
commit
2018a18d15
|
@ -259,7 +259,7 @@ You can use '{discard}' and numbers to distinguish between similar names.
|
|||
name: String,
|
||||
},
|
||||
|
||||
#[error("I found a data type that has a function type in it. This is not allowed.\n")]
|
||||
#[error("I found a type definition that has a function type in it. This is not allowed.\n")]
|
||||
#[diagnostic(code("illegal::function_in_type"))]
|
||||
#[diagnostic(help("Data-types can't hold functions. If you want to define method-like functions, group the type definition and the methods under a common namespace in a standalone module."))]
|
||||
FunctionTypeInData {
|
||||
|
@ -267,6 +267,18 @@ You can use '{discard}' and numbers to distinguish between similar names.
|
|||
location: Span,
|
||||
},
|
||||
|
||||
#[error("I found a type definition that has an unsupported type in it.\n")]
|
||||
#[diagnostic(code("illegal::type_in_data"))]
|
||||
#[diagnostic(help(
|
||||
r#"Data-types can't contain type {type_info} because it can't be represented as PlutusData."#,
|
||||
type_info = tipo.to_pretty(0).if_supports_color(Stdout, |s| s.red())
|
||||
))]
|
||||
IllegalTypeInData {
|
||||
#[label]
|
||||
location: Span,
|
||||
tipo: Rc<Type>,
|
||||
},
|
||||
|
||||
#[error("I found a discarded expression not bound to a variable.\n")]
|
||||
#[diagnostic(code("implicit_discard"))]
|
||||
#[diagnostic(help(
|
||||
|
@ -951,6 +963,7 @@ impl ExtraData for Error {
|
|||
| Error::DuplicateVarInPattern { .. }
|
||||
| Error::ExtraVarInAlternativePattern { .. }
|
||||
| Error::FunctionTypeInData { .. }
|
||||
| Error::IllegalTypeInData { .. }
|
||||
| Error::ImplicitlyDiscardedExpression { .. }
|
||||
| Error::IncorrectFieldsArity { .. }
|
||||
| Error::IncorrectFunctionCallArity { .. }
|
||||
|
|
|
@ -545,6 +545,13 @@ fn infer_definition(
|
|||
location: *location,
|
||||
});
|
||||
}
|
||||
|
||||
if tipo.is_bls381_12_g1() || tipo.is_bls381_12_g2() || tipo.is_ml_result() {
|
||||
return Err(Error::IllegalTypeInData {
|
||||
location: *location,
|
||||
tipo: tipo.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue