Uploaded image for project: 'Swift'
  1. Swift
  2. SR-7771

Forming Single-Element Tuple Abstraction Patterns Causes SILGen Instability

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Compiler
    • Labels:

      Description

      SILGen is not set up to handle the case where its abstraction pattern is a single-element tuple and the substituted type is a single element.  This simple piece of code crashes the result plan builder trying to lower exactly this case:

       

       

      func foo(x: Int = 3) -> Int {
        return x
      }
      foo(x:)()
      

       

      Unless we remove all the sources trying to form these kinds of abstraction patterns, all the parts of SILGen that just check isTuple() without checking the substType have the potential to trigger more bugs.  The current representation for enum cases (and their associated thunks) are also subject to this but we will not see the consequences of this until SE-0155 is implemented.

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rwidmann Robert Widmann
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: