BUG-38021: add the superType check for loop expressions; also did some cleanup, moved the typeTest logic to GraphPersistenceStrategies