Skip to content

[Parse] Don't propagate static spelling to AST while parsing top level decls #5104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2016

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Oct 3, 2016

FuncDecl of static func foo() {} in top level was accidentally isStatic().
That causes assertion failure in ASTPrinter.

This was the immediate cause of compiler_crashers/28429-swift-decl-print.swift .

…l decls

`FuncDecl` of `static func foo() {}` in top level was accidentally
`isStatic()`. That causes assertion failure in `ASTPrinter`.
@slavapestov
Copy link
Contributor

Shouldn't you run resolve-crashers.py to move that crasher to compiler_crashers_fixed?

@slavapestov
Copy link
Contributor

@swift-ci Please smoke test

@slavapestov slavapestov self-assigned this Oct 3, 2016
@rintaro
Copy link
Member Author

rintaro commented Oct 4, 2016

@slavapestov
This PR does not resolve the crasher, because #5099 is the root cause of that.
It seems that #5099 causes ASTVerifier error, but because of this problem, it fails to emit diagnostic message.

28429-swift-decl-print.swift output after this PR

child source range not contained within its parent: func g()
  parent range: [validation-test/compiler_crashers/28429-swift-decl-print.swift:10:1 - line:11:16] RangeText="{class
func g:protocol<"
  child range: [validation-test/compiler_crashers/28429-swift-decl-print.swift:11:1 - line:12:1] RangeText="func g:protocol<
"
0  swift           0x00000000034bc4a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift           0x00000000034bd086
2  libpthread.so.0 0x00007fc3dd475d10
3  libc.so.6       0x00007fc3dbdbd1c7 gsignal + 55
4  libc.so.6       0x00007fc3dbdbee2a abort + 362
5  swift           0x00000000010f2de4
6  swift           0x00000000010f047f
7  swift           0x00000000010ef1eb
8  swift           0x00000000010fde39
9  swift           0x00000000010ff482
10 swift           0x000000000110284c
11 swift           0x00000000010ff427
12 swift           0x00000000010fdbca
13 swift           0x00000000010fd794 swift::Decl::walk(swift::ASTWalker&) + 20
14 swift           0x0000000001152aee swift::SourceFile::walk(swift::ASTWalker&) + 174
15 swift           0x00000000010e53e5 swift::verify(swift::SourceFile&) + 53
16 swift           0x0000000000ea6a33 swift::Parser::parseTopLevel() + 563
17 swift           0x0000000000edb1a0 swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 208
18 swift           0x0000000000cedaa6 swift::CompilerInstance::performSema() + 3254
19 swift           0x00000000008313af
20 swift           0x000000000083046e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2702
21 swift           0x00000000007f86fb main + 2747
22 libc.so.6       0x00007fc3dbda8ac0 __libc_start_main + 240
23 swift           0x00000000007f5f49 _start + 41
Stack dump:
0.  Program arguments: /home/rintaro/Documents/swift-oss/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift -frontend -parse -primary-file validation-test/compiler_crashers/28429-swift-decl-print.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -module-name main 
1.  With parser at source location: validation-test/compiler_crashers/28429-swift-decl-print.swift:12:1
2.  While walking into decl declaration 0x6db1e30 at validation-test/compiler_crashers/28429-swift-decl-print.swift:10:1
3.  While verifying ranges 'g' at validation-test/compiler_crashers/28429-swift-decl-print.swift:11:1

@slavapestov
Copy link
Contributor

@swift-ci Please smoke test and merge

@swift-ci swift-ci merged commit ffe22f6 into swiftlang:master Oct 24, 2016
@rintaro rintaro deleted the static-toplevel branch October 24, 2016 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants