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

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

I have the following struct:

public struct SomeStruct {
    var valueAdded: Bool = false
    var values = [Any]()
    public func addValue_Fail(_ aValue: Any) {
        valueAdded = true
    public mutating func addValue_Ok(_ aValue: Any) {
        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: (16.4 KB)

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

Thanks, logged as bugs://82377

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

Curiously; it’s not really missing, it’s just hidden behind the Variable is assigned but never read.

bugs://82377 got closed with status fixed.