@Override
    protected Type typeCheckLocal(Scope<Type> scope) {
        return context("while resolving the type of reference " + name, this, () -> {
            Type baseType = scope.expectValue(name);
            if (scope.isNonNull(this)) {
                return baseType.expectOptionalType().inner();
            } else {
                return baseType;
            }
        });
    }
Gets the name of the field being referenced.

@return the name of the referenced field.
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/language/syntax/expressions/Reference.java