GROOVY-6841: Fix NPE during compilation if scope is null