skiptools / skiptools/skip

Error when bridging `mutable func` for an enum

Open
#531 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
3.2k
Forks
106
Avg merge
6d 13h
Merged PRs (30d)
1

Description

When trying to export the following code:

public enum Foo {
  case something
  case anotherthing
  public mutating func applyMarketUpdate(_ update: String) { }
}

It fails with the following output:

/Users/piercifani/Desktop/skip-errors/protocols-errors/travel-posters-model/.build/plugins/outputs/travel-posters-model/TravelPostersModel/destination/skipstone/TravelPostersModel/build/swift/plugins/outputs/swift/TravelPostersModel/destination/skipstone/SkipBridgeGenerated/Experiments_Bridge.swift:77:12: error: 'mutating' is not valid on instance methods in classes
/Users/piercifani/Desktop/skip-errors/protocols-errors/travel-posters-model/.build/plugins/outputs/travel-posters-model/TravelPostersModel/destination/skipstone/TravelPostersModel/build/swift/plugins/outputs/swift/TravelPostersModel/destination/skipstone/SkipBridgeGenerated/Experiments_Bridge.swift:77:12: error: 'mutating' is not valid on instance methods in classes
/Users/piercifani/Desktop/skip-errors/protocols-errors/travel-posters-model/.build/plugins/outputs/travel-posters-model/TravelPostersModel/destination/skipstone/TravelPostersModel/build/swift/plugins/outputs/swift/TravelPostersModel/destination/skipstone/SkipBridgeGenerated/Experiments_Bridge.swift:264:16: error: cannot use mutating member on immutable value: 'peer_swift' is a 'let' constant

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Swift enum export with the mutating method shown in the issue, then inspect the generated Experiments_Bridge.swift at the reported error location. Confirm the generated bridge compiles for the enum case and that the reported mutating-method errors no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.