Non-mutating struct method partially compiles in Java/Android but shouldn't

(ndelic) #1

IDE: Fire
Version: .2395
Target (If relevant): Java/Android
Description:

I have the following struct:

public struct SomeStruct {
    
    var valueAdded: Bool = false
    var values = [Any]()
    
    public func addValue_Fail(_ aValue: Any) {
        values.append(aValue)
        valueAdded = true
    }
    
    public mutating func addValue_Ok(_ aValue: Any) {
        values.append(aValue)
        valueAdded = true
    }
}

Expected Behavior:

  • The addValue_Ok method should compile fine.
  • The addValue_Fail method should fail to compile in both lines, which happens in XCode macOS app and Fire/NetStandard library project:

Actual Behavior:

In Java/Android class library, the first line in addValue_Fail method compiles, but shouldn’t:

StructTest.zip (16.4 KB)

0 Likes

(marc hoffman) #2

Curious, if it doesn’t fail as expected, how you got the first screenshot?

0 Likes

(RemObjects) #3

Thanks, logged as bugs://82377

0 Likes

(ndelic) #4

First screenshot is from NetStandard project, second one is from Android project. I believe the attached test project fails in all the right places. :wink:

1 Like