Fix asnotnull

Add warnings on useless as(not null)  (one less TODO) and fix the bug on non-null primitives.

Fixes #589