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

compareImports() in ModuleInterfacePrinting.cpp looks buggy

    XMLWordPrintable

    Details

      Description

      The helper function compareImports() in ModuleInterfacePrinting.cpp attempts to compare two {{ImportDecl}}s by their import paths (the dotted identifiers in them) to sort them into a stable order, but if the two import paths have different numbers of identifiers, it looks like it will consider them equal.

      I don't have a test case that will actually cause buggy behavior, so you will need to:

      1. Read the code around it to figure out how it is used.
      2. Devise a test case that will cause visibly buggy behavior.
      3. Actually fix the bug.

      I noticed this while working on a large pull request that touches this code; please wait until I've landed that to fix this bug.

        Attachments

          Activity

            People

            Assignee:
            interfere Alexey Komnin
            Reporter:
            beccadax Becca Royal-Gordon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: