Don't ICE when protocol steps to invalid mesasge.

This commit is contained in:
Eric Holk 2012-07-17 12:51:24 -07:00
parent 4cf6b4d3b4
commit ee855caa5d

View file

@ -44,28 +44,29 @@ impl proto_check of proto::visitor<(), (), ()> for ext_ctxt {
fn visit_message(name: ident, _tys: &[@ast::ty], fn visit_message(name: ident, _tys: &[@ast::ty],
this: state, next: next_state) { this: state, next: next_state) {
alt next { alt next {
some({state: next, tys: next_tys}) { some({state: next, tys: next_tys}) {
let proto = this.proto; let proto = this.proto;
if !proto.has_state(next) { if !proto.has_state(next) {
// This should be a span fatal, but then we need to // This should be a span fatal, but then we need to
// track span information. // 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() {
self.span_err( self.span_err(
empty_span(), // use a real span empty_span(),
#fmt("message %s target (%s) \ #fmt("message %s steps to undefined state, %s",
needs %u type parameters, but got %u", *name, *next));
*name, *next.name, }
next.ty_params.len(), else {
next_tys.len())); 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 { } none { }