Skip to content
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

[SR-4444] Shadowing and order dependency #47021

Open
dabrahams opened this issue Mar 31, 2017 · 2 comments
Open

[SR-4444] Shadowing and order dependency #47021

dabrahams opened this issue Mar 31, 2017 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@dabrahams
Copy link
Collaborator

Previous ID SR-4444
Radar rdar://problem/31361075
Original Reporter @dabrahams
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @DougGregor
Priority Medium

md5: abbfddf007840ef5c25c485539424782

relates to:

  • SR-8524 Shadowing in protocols leads to difficult to find bugs

Issue Description:

with

$ git fetch https://github.com/dabrahams/swift refs/bugs/shadowing-order-dependence:BUG && git checkout BUG

Build swift, then run the Prototypes/AU3.swift test:

-*- mode: compilation; default-directory: "/scp:halsted:/Users/dave/src/s/swift/test/Prototypes/" -*-
Compilation started at Thu Mar 30 17:07:46

rm -rf /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp && mkdir -p /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp && /Users/Shared/dabrahams/s/swift/utils/gyb -DWORD_BITS=64 /Users/Shared/dabrahams/s/swift/test/Prototypes/AU3.swift.gyb -o /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/out.swift && /Users/Shared/dabrahams/s/swift/utils/line-directive /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/out.swift -- xcrun --toolchain default --sdk /Applications/Xcode-8E161.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/./bin/swiftc -target x86_64-apple-macosx10.9  -module-cache-path '/var/folders/k9/nzq6k4f57xb5vw8wrgk_7cvh0000gn/T/swift-testsuite-clang-module-cache1bLYIW' -F /Applications/Xcode-8E161.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/../../../Developer/Library/Frameworks -Xlinker -rpath -Xlinker /Applications/Xcode-8E161.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/../../../Developer/Library/Frameworks  -swift-version 3  /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/out.swift -o /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/a.out -Onone -g && /Users/Shared/dabrahams/s/swift/utils/line-directive /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/out.swift --  /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/a.out "--stdlib-unittest-in-process" "--stdlib-unittest-filter" "ViewValueSemantics"
Could not cast value of type 'a.AnyUInt16UnicodeView.Adapter<a.RandomAccessUnicodeView<Swift.Array<Swift.UInt16>>>' (0x7fc25c012ce0) to 'a.AnyUInt16UnicodeView.Adapter<a.RandomAccessUnicodeView<Swift._UTF16StringStorage>>' (0x7fc25c015cf0).
StdlibUnittest: using filter: ViewValueSemantics
[ RUN      ] AnyUnicode.ViewValueSemantics

Compilation exited abnormally with code 250 at Thu Mar 30 17:08:12

Now take the declaration of protocol UnicodeView and move it to the top of the test file. Now the test will pass. I think the generic init of AnyUInt16UnicodeView on line 546 is looking up "UnicodeView" and finding it in the standard library instead of in this module.

Other hashes:

clang                              a4170877a0 Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
cmark                              d875488 Merge pull request #&#8203;4 from llvm-beanz/generate-cmark-exports
compiler-rt                        ccc20796d Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
llbuild                            b696a76 Merge pull request #&#8203;134 from hughbe/wsl-expected
lldb                               ca932e489 Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
llvm                               808ed5e711d Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
ninja                              0b0374e Merge pull request #&#8203;1255 from tchajed/bind-localhost
swift                              ba2b68f921 Merge pull request #&#8203;8436 from milseman/wip_strings_prototype
swift-corelibs-foundation          a6e77b4 Merge pull request #&#8203;924 from ianpartridge/nsregularexpression
swift-corelibs-libdispatch         d137aa4 Makes the DispatchIO initializer that accepts a path failable, reflecting the fact that a relative or non-existent path is invalid.
swift-corelibs-xctest              50cc074 XCTestAssertNoThrow (#184)
swift-integration-tests            8ae3586 Merge pull request #&#8203;18 from apple/disable-lldb-test
swift-xcode-playground-support     9e980f2 Temporary disable test to get the incremental bot blue again
swiftpm                            6d416488 [Workspace] Move root constraints out of DependencyManifests
@dabrahams
Copy link
Collaborator Author

@swift-ci create

@belkadan
Copy link
Contributor

Likely comes from the way main source files are parsed in chunks. I didn't think we were type-checking them in chunks too, but maybe that's how we forbid the unsafe forward references.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants