swift
c94d8130 - [migrator] Treat the top-level argument parens of function types as an index level in the ChildIndexFinder

Commit
7 years ago
[migrator] Treat the top-level argument parens of function types as an index level in the ChildIndexFinder The APIDiffMigrator pass was ignoring them in all cases, but function type argument parens are significant and the API differ includes them as an index level in the generated json. This was causing a segmentation fault when trying to migrate anything inside a function type argument. E.g given the function below: func member(_ x: ([Any]?) -> Void) {} to migrate Any to Int, the API differ produces an index into the signauture of 1:1:0:0:0, meant to indicate Any. The APIDiffMigratorPass was interpreting this incorrectly, however: 1: The type of first parameter of member: ([Any]?) -> Void Migrator agreed. 1: The type of the function type's argument: ([Any]?) Migrator saw this as [Any]? due to the parens not being an index level 0: The 0th child of the paren type: [Any]? Migrator saw the 0th child of the optional, [Any] 0: the 0th child of the optional type, [Any] Migrator saw the 0th child of the array, Any 0: the 0th child of the array type, Any Migrator tried to look up the 0th child of Any, causing a crash. Resolves rdar://problem/40225476.
Author
Nathan Hawes
Committer
Nathan Hawes
Parents
Loading