From bdff5d43f5108f403fa094c06d1236bb3f6986f6 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Sun, 12 Apr 2015 00:11:40 +0700 Subject: [PATCH] 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 --- lib/a_star.nit | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- 1.7.9.5