Fix regression with data declarations in where

Also, start adding tests for examples from the tutorial (we need to
cover it all, really).