Fix var-parameter detection for inferred params #4980

Merged
merged 1 commit into from Sep 26, 2016

Projects

None yet

4 participants

@harlanhaskins
Collaborator
  • Explanation: We've removed the 'var' modifier from function parameters in Swift 3, but the diagnostic for that is only emitted when we have a valid type loc. With inferred closure parameters, you're allowed to specify a parameter without a type. If you leave 'var' on one of those, it causes an assertion in SILGen. Instead, teach the diagnostic to handle omitted types.
  • Scope: Only affects function parameters with elided types.
  • Issue: SR-2562
  • Reviewed by: @DougGregor and @CodaFi
  • Risk: Low.
  • Testing: Added a test to cover this diagnostic.
@harlanhaskins
Collaborator

@swift-ci please test

@swift-ci
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 80f67ae
Test requested by - @harlanhaskins

@swift-ci
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 80f67ae
Test requested by - @harlanhaskins

@harlanhaskins
Collaborator

There is a crasher that no longer crashes. I'll move it.

@DougGregor DougGregor added this to the Swift 3.0 milestone Sep 24, 2016
@harlanhaskins harlanhaskins Fix var-parameter detection for inferred params
Previously, we would skip validating the type (and checking var/inout)
on parameters that didn't have an explicit type. Instead, teach
validateParameterType how to handle an elided type.
1bfee7b
@harlanhaskins
Collaborator

@swift-ci please test

@tkremenek
Member

@swift-ci clean test

@tkremenek tkremenek merged commit 504504b into apple:swift-3.0-branch Sep 26, 2016

4 checks passed

Swift Test Linux Platform Build finished.
Details
Swift Test Linux Platform (smoke test)
Details
Swift Test OS X Platform Build finished. 42620 tests run, 0 skipped, 0 failed.
Details
Swift Test OS X Platform (smoke test)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment