allow the Closure version of the `protected` tag to specify a type (#731)

Also adds tests for the `protected` tag.