From: Jean Privat Date: Sat, 11 Apr 2015 17:11:40 +0000 (+0700) Subject: lib/a_star: avoid bad autocast X-Git-Tag: v0.7.4~26^2~4 X-Git-Url: http://nitlanguage.org lib/a_star: avoid bad autocast Seriously, this one case might be a strong argument against autocasts ~~~ frontier_node = frontier_node.best_source.as(not null) ~~~ is auto-casted as ~~~ frontier_node = frontier_node.best_source.as(not null).as(N) ~~~ bun since the N is `nullable Node`, the not-null information was lost in the cast. Signed-off-by: Jean Privat --- diff --git a/lib/a_star.nit b/lib/a_star.nit index 2cbd7cf..9735d90 100644 --- a/lib/a_star.nit +++ b/lib/a_star.nit @@ -147,7 +147,8 @@ class Node while frontier_node != self do path.nodes.unshift(frontier_node) - frontier_node = frontier_node.best_source.as(not null) + frontier_node = frontier_node.best_source + assert frontier_node != null end return path