Don't ICE when protocol steps to invalid mesasge.
This commit is contained in:
parent
4cf6b4d3b4
commit
ee855caa5d
@ -44,28 +44,29 @@ fn visit_state(state: state, _m: &[()]) {
|
||||
|
||||
fn visit_message(name: ident, _tys: &[@ast::ty],
|
||||
this: state, next: next_state) {
|
||||
alt next {
|
||||
some({state: next, tys: next_tys}) {
|
||||
let proto = this.proto;
|
||||
if !proto.has_state(next) {
|
||||
// This should be a span fatal, but then we need to
|
||||
// track span information.
|
||||
self.span_err(
|
||||
empty_span(),
|
||||
#fmt("message %s steps to undefined state, %s",
|
||||
*name, *next));
|
||||
}
|
||||
|
||||
let next = proto.get_state(next);
|
||||
|
||||
if next.ty_params.len() != next_tys.len() {
|
||||
alt next {
|
||||
some({state: next, tys: next_tys}) {
|
||||
let proto = this.proto;
|
||||
if !proto.has_state(next) {
|
||||
// This should be a span fatal, but then we need to
|
||||
// track span information.
|
||||
self.span_err(
|
||||
empty_span(), // use a real span
|
||||
#fmt("message %s target (%s) \
|
||||
needs %u type parameters, but got %u",
|
||||
*name, *next.name,
|
||||
next.ty_params.len(),
|
||||
next_tys.len()));
|
||||
empty_span(),
|
||||
#fmt("message %s steps to undefined state, %s",
|
||||
*name, *next));
|
||||
}
|
||||
else {
|
||||
let next = proto.get_state(next);
|
||||
|
||||
if next.ty_params.len() != next_tys.len() {
|
||||
self.span_err(
|
||||
empty_span(), // use a real span
|
||||
#fmt("message %s target (%s) \
|
||||
needs %u type parameters, but got %u",
|
||||
*name, *next.name,
|
||||
next.ty_params.len(),
|
||||
next_tys.len()));
|
||||
}
|
||||
}
|
||||
}
|
||||
none { }
|
||||
|
Loading…
Reference in New Issue
Block a user