tailor icon indicating copy to clipboard operation
tailor copied to clipboard

Parsing failure when omitting name of associated value in enum

Open valerianb opened this issue 8 years ago • 3 comments

Tailor Version: v0.11.1

Swift Version: 3.0.1

Platform (Mac/Linux/Windows/CI): Mac

Installation Method: Homebrew

Steps to Reproduce Issue

  1. Make a new file with
enum DataState<T> {
  case empty
  case any(data: T)
}

enum TableViewState<T: String> {
  case data(_: DataState<T>)
  case error
}

Expected Behavior

File parsed

Actual Behavior

Parsing failed:

line 8:12 mismatched input '_' expecting ')'

valerianb avatar Feb 09 '17 10:02 valerianb

@valerianb, thanks for reporting. We are looking into it.

adityatrivedi avatar Feb 16 '17 06:02 adityatrivedi

@valerianb, I apologize for the delayed response. It looks like the code snippet you shared does not compile.

I removed : String from the sample code you shared and tailor appears to parse it correctly.

screen shot 2017-03-05 at 9 26 53 pm

Would you be able to provide an example that compiles and illustrates the parsing failure you are experiencing?

adityatrivedi avatar Mar 06 '17 06:03 adityatrivedi

No worries for the delay.

Here's the original code:

enum TableViewDataState<T> {
  case empty(infoViewContent: InfoViewContent, data: T)
  case any(data: T)
}
  
enum TableViewErrorState {
  case offline(infoViewContent: InfoViewContent)
  case error(infoViewContent: InfoViewContent)
}

enum TableViewState<T: DateableResult> {
  case data(_: TableViewDataState<T>)
  case error(_: TableViewErrorState)
  case placeholder
  
}

protocol DateableResult {
  var age: Date { get }
}

Result of tailor: Analyzing 1 file: line 15:12 mismatched input '_' expecting ')'

valerianb avatar Mar 06 '17 08:03 valerianb