(PUP-1960) Make Resource and Class types produce [] on empty input

If Resource[expr], or Class[expr] are evaluated and the keys expr
results in an empty array after fattening and compaction, the operation
produces an empty array after giving a warning. 

This is helpful in situations where the expr is a function call that may
result in an empty array.

In this commit the ability to configure errors to produce warnings and
to allow configuration of severity has been added.
(PUP-1960) Reverse the order of compact and flatten

It is best to flatten before compacting.
Merge pull request #2505 from hlindberg/pup-1960_empty-resource-reference-list

(PUP-1960) empty resource reference list