SR-11838 Cycle involving implicit initializers and witness resolution
Issue Description:
import _Differentiation
// NOTE: No crash if `class` is changed to `struct`.
class Class: Differentiable {
// NOTE: No crash if `@differentiable` attribute is removed.
@differentiable
var x: Float = 10
var y: NonExistentType = 30
}
$ swiftc error.swift
error.swift:11:3: warning: synthesis of the 'Differentiable.move(along:)' requirement for 'Class' requires 'wrappedValue' in property wrapper 'Wrapper' to be mutable; add an explicit '@noDerivative' attribute
@differentiable
^
@noDerivative
checked decl cannot have error type
(accessor_decl implicit range=[error.swift:14:7 - line:14:7] 'anonname=0x7fd7258992a0' interface type='(Class) -> () -> <<error type>>' access=internal get_for=y
(parameter "self" type='Class' interface type='Class')
(parameter_list)
(brace_stmt implicit range=[error.swift:14:7 - line:14:7]
(return_stmt implicit
(member_ref_expr implicit type='<<error type>>' decl=error.(file).Class.y@error.swift:14:7 direct_to_storage
(declref_expr implicit type='Class' decl=error.(file).Class.<anonymous>.self@error.swift:14:7 function_ref=unapplied)))))
Stack dump:
0. Program arguments: /Users/danielzheng/swift-tf/build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swift -frontend -c -primary-file error.swift -target x86_64-apple-darwin19.4.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -target-sdk-version 10.15.4 -module-name error -o /var/folders/m_/6f7q8zfs3n9fr0c_4gy8840m00hc_q/T/error-df9d65.o
1. Swift version 5.3-dev (LLVM 537023d5f0, Swift f2b25f7355)
2. While walking into decl 'Class' (at error.swift:9:1)
3. While verifying AccessorDecl getter for y (at error.swift:14:7)
4. While verifying FuncDecl getter for y (at error.swift:14:7)
5. While verifying AbstractFunctionDecl getter for y (at error.swift:14:7)
0 swift 0x000000010fd2f218 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x000000010fd2e198 llvm::sys::RunSignalHandlers() + 248
2 swift 0x000000010fd2f80d SignalHandler(int) + 285
3 libsystem_platform.dylib 0x00007fff6a3e15fd _sigtramp + 29
4 libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338733709856
5 libsystem_c.dylib 0x00007fff6a2b7808 abort + 120
6 swift 0x00000001101f41b0 (anonymous namespace)::Verifier::verifyChecked(swift::VarDecl*) (.cold.1) + 0
7 swift 0x000000010c78efae (anonymous namespace)::Verifier::verifyChecked(swift::ValueDecl*) + 174
8 swift 0x000000010c78fc08 (anonymous namespace)::Verifier::verifyChecked(swift::AbstractFunctionDecl*) + 888
9 swift 0x000000010c78fdda (anonymous namespace)::Verifier::verifyChecked(swift::FuncDecl*) + 314
What's expected is a "type not found in scope" diagnostic:
error.swift:9:10: error: cannot find type 'NonExistentType' in scope
var y: NonExistentType = 30
^~~~~~~~~~~~~~~
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, AutoDiff, CompilerCrash | |Assignee | @rxwei | |Priority | Medium | md5: 0b10d7cbd6875867fcb054de325ea6eerelates to:
Issue Description:
What's expected is a "type not found in scope" diagnostic: