Guard let inconsistency

This compiles in Xcode, but fails in Fire .2485 (Android library) with “Duplicate variable”:

class ValueClass {
    private var values = [Int: String]()
    public subscript(anID: Int) -> String? {
        guard let result: String = values[anID] else {
            let result: String = "NewValue"
            values[anID] = result
            return result
        return result

Hmm, imho this should fail, as that’s indeed a dupe variable ion the same scope, no? :woman_shrugging:t3:

AFAIK variable defined by guard let/var statement is only available “outside” guard statement, i.e. if guard is successful. So, as far as code “inside” guard statement is concerned, the variable was never defined because guard was not successful. So it can be safely defined (again). Xcode compiles it. Just my 2c, it’s not a show stopper.

Hmm, I suppose. I’ll log it for review, thanx.

Thanks, logged as bugs://84149