Skip to content

Commit 327c69e

Browse files
committed
[Parse] Don't update interface hash unless parsing interface tokens
Previously, parsing function bodies used to update interface hash regardless of the flag. Parsing local function should not update it.
1 parent 3794aab commit 327c69e

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5354,9 +5354,11 @@ void Parser::parseAbstractFunctionBody(AbstractFunctionDecl *AFD) {
53545354
return;
53555355
}
53565356

5357-
// Record the curly braces but nothing inside.
5358-
SF.recordInterfaceToken("{");
5359-
SF.recordInterfaceToken("}");
5357+
if (IsParsingInterfaceTokens) {
5358+
// Record the curly braces but nothing inside.
5359+
SF.recordInterfaceToken("{");
5360+
SF.recordInterfaceToken("}");
5361+
}
53605362
llvm::SaveAndRestore<bool> T(IsParsingInterfaceTokens, false);
53615363

53625364
if (isDelayedParsingEnabled()) {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %{python} %utils/split_file.py -o %t %s
3+
// RUN: %target-swift-frontend -dump-interface-hash %t/a.swift 2> %t/a.hash
4+
// RUN: %target-swift-frontend -dump-interface-hash %t/b.swift 2> %t/b.hash
5+
// RUN: cmp %t/a.hash %t/b.hash
6+
7+
// BEGIN a.swift
8+
func test() -> Int {
9+
return 0
10+
}
11+
12+
// BEGIN b.swift
13+
func test() -> Int {
14+
func inner() -> Int{
15+
return 0
16+
}
17+
return inner()
18+
}

0 commit comments

Comments
 (0)