Add a helper for tests
Better type inference on declared vars. Fixes issue 1056
R=johnlenz