mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Revert "[ReconstructType] Fix decl lookup when there are multiple constructors"
This reverts commit 65c86b713d.
I attempted to resolve the merge conflict, but Jordan will need to do
a second check.
This commit is contained in:
@@ -1058,15 +1058,6 @@ static void VisitNodeConstructor(
|
|||||||
case TypeKind::Function: {
|
case TypeKind::Function: {
|
||||||
const AnyFunctionType *identifier_func =
|
const AnyFunctionType *identifier_func =
|
||||||
identifier_type->getAs<AnyFunctionType>();
|
identifier_type->getAs<AnyFunctionType>();
|
||||||
|
|
||||||
// inits are typed as (Foo.Type) -> (args...) -> Foo, but don't
|
|
||||||
// assert that in case we're dealing with broken code.
|
|
||||||
if (identifier_func->getInput()->is<AnyMetatypeType>() &&
|
|
||||||
identifier_func->getResult()->is<AnyFunctionType>()) {
|
|
||||||
identifier_func =
|
|
||||||
identifier_func->getResult()->getAs<AnyFunctionType>();
|
|
||||||
}
|
|
||||||
|
|
||||||
const AnyFunctionType *type_func =
|
const AnyFunctionType *type_func =
|
||||||
type_result._types.front()->getAs<AnyFunctionType>();
|
type_result._types.front()->getAs<AnyFunctionType>();
|
||||||
if (CanType(identifier_func->getResult()
|
if (CanType(identifier_func->getResult()
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ set(swift_stdlib_unittest_module_depends
|
|||||||
SwiftPrivate SwiftPrivatePthreadExtras SwiftPrivateLibcExtras)
|
SwiftPrivate SwiftPrivatePthreadExtras SwiftPrivateLibcExtras)
|
||||||
set(swift_stdlib_unittest_framework_depends)
|
set(swift_stdlib_unittest_framework_depends)
|
||||||
set(swift_stdlib_unittest_private_link_libraries)
|
set(swift_stdlib_unittest_private_link_libraries)
|
||||||
set(swift_stdlib_unittest_compile_flags
|
set(swift_stdlib_unittest_compile_flags)
|
||||||
"-Xfrontend" "-disable-objc-attr-requires-foundation-module")
|
|
||||||
|
|
||||||
if(SWIFT_HOST_VARIANT MATCHES "${SWIFT_DARWIN_VARIANTS}")
|
if(SWIFT_HOST_VARIANT MATCHES "${SWIFT_DARWIN_VARIANTS}")
|
||||||
list(APPEND swift_stdlib_unittest_platform_sources
|
list(APPEND swift_stdlib_unittest_platform_sources
|
||||||
|
|||||||
@@ -448,30 +448,8 @@ let _crashedPrefix = "CRASHED:"
|
|||||||
@_silgen_name("swift_stdlib_installTrapInterceptor")
|
@_silgen_name("swift_stdlib_installTrapInterceptor")
|
||||||
func _stdlib_installTrapInterceptor()
|
func _stdlib_installTrapInterceptor()
|
||||||
|
|
||||||
#if _runtime(_ObjC)
|
|
||||||
@objc protocol _StdlibUnittestNSException {
|
|
||||||
optional var name: AnyObject { get }
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
func _childProcess() {
|
func _childProcess() {
|
||||||
_stdlib_installTrapInterceptor()
|
_stdlib_installTrapInterceptor()
|
||||||
|
|
||||||
#if _runtime(_ObjC)
|
|
||||||
objc_setUncaughtExceptionHandler {
|
|
||||||
var stderr = _Stderr()
|
|
||||||
let maybeNSException = unsafeBitCast($0, to:_StdlibUnittestNSException.self)
|
|
||||||
if let name = maybeNSException.name {
|
|
||||||
print("*** [StdlibUnittest] Terminating due to uncaught exception " +
|
|
||||||
"\(name): \($0)",
|
|
||||||
to: &stderr)
|
|
||||||
} else {
|
|
||||||
print("*** [StdlibUnittest] Terminating due to uncaught exception: \($0)",
|
|
||||||
to: &stderr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while let line = _stdlib_getline() {
|
while let line = _stdlib_getline() {
|
||||||
let parts = line._split(separator: ";")
|
let parts = line._split(separator: ";")
|
||||||
let testSuiteName = parts[0]
|
let testSuiteName = parts[0]
|
||||||
|
|||||||
@@ -7,15 +7,6 @@ struct Mystruct1 {
|
|||||||
var intField = 3
|
var intField = 3
|
||||||
// CHECK: decl: var intField: Int
|
// CHECK: decl: var intField: Int
|
||||||
}
|
}
|
||||||
struct MyStruct2 {
|
|
||||||
// CHECK: decl: struct MyStruct2
|
|
||||||
init() {}
|
|
||||||
// CHECK: decl: init()
|
|
||||||
init(x: Int) {}
|
|
||||||
// CHECK: decl: init(x: Int)
|
|
||||||
init(x: Int, y: Int) {}
|
|
||||||
// CHECK: decl: init(x: Int, y: Int)
|
|
||||||
}
|
|
||||||
|
|
||||||
class Myclass1 {
|
class Myclass1 {
|
||||||
// CHECK: decl: class Myclass1
|
// CHECK: decl: class Myclass1
|
||||||
@@ -25,14 +16,13 @@ class Myclass1 {
|
|||||||
|
|
||||||
func f1() {
|
func f1() {
|
||||||
// CHECK: decl: func f1()
|
// CHECK: decl: func f1()
|
||||||
var s1ins = Mystruct1() // Implicit ctor
|
var s1ins = Mystruct1()
|
||||||
// CHECK: decl: var s1ins: Mystruct1
|
// CHECK: decl: var s1ins: Mystruct1
|
||||||
// CHECK: dref: init() for 'Mystruct1'
|
// FIXME: missing init()?
|
||||||
_ = Mystruct1(intField: 1) // Implicit ctor
|
// CHECK: dref: FAILURE for 'Mystruct1' usr=s:FV14swift_ide_test9Mystruct1cFT_S0_
|
||||||
// CHECK: dref: init(intField: Int) for 'Mystruct1'
|
// CHECK: type: Mystruct1
|
||||||
|
|
||||||
s1ins.intField = 34
|
s1ins.intField = 34
|
||||||
// CHECK: type: Mystruct1
|
|
||||||
// CHECK: type: Int
|
// CHECK: type: Int
|
||||||
|
|
||||||
var c1ins = Myclass1()
|
var c1ins = Myclass1()
|
||||||
@@ -80,9 +70,6 @@ class Myclass2 {
|
|||||||
|
|
||||||
arr3.append(Myclass1())
|
arr3.append(Myclass1())
|
||||||
// CHECK: type: @lvalue Array<Myclass1> -> Myclass1 -> ()
|
// CHECK: type: @lvalue Array<Myclass1> -> Myclass1 -> ()
|
||||||
|
|
||||||
_ = Myclass2.init()
|
|
||||||
// CHECK: dref: init()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
// RUN: %target-run-simple-swift 2>&1 | FileCheck %s
|
|
||||||
// REQUIRES: executable_test
|
|
||||||
// REQUIRES: objc_interop
|
|
||||||
|
|
||||||
import StdlibUnittest
|
|
||||||
import ObjectiveC
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
// Don't actually exit with a non-zero status, just say we're going to do it.
|
|
||||||
_setTestSuiteFailedCallback() { print("abort()") }
|
|
||||||
|
|
||||||
|
|
||||||
func raiseNSException() {
|
|
||||||
NSException(name: "Trogdor", reason: "Burnination", userInfo: nil).raise()
|
|
||||||
}
|
|
||||||
|
|
||||||
var TestSuiteCrashes = TestSuite("NSExceptionCrashes")
|
|
||||||
|
|
||||||
TestSuiteCrashes.test("uncaught") {
|
|
||||||
print("uncaught")
|
|
||||||
raiseNSException()
|
|
||||||
}
|
|
||||||
// CHECK-LABEL: stdout>>> uncaught
|
|
||||||
// CHECK: stderr>>> *** [StdlibUnittest] Terminating due to uncaught exception Trogdor: Burnination
|
|
||||||
// CHECK: stderr>>> CRASHED: SIG
|
|
||||||
// CHECK: the test crashed unexpectedly
|
|
||||||
// CHECK: [ FAIL ] NSExceptionCrashes.uncaught
|
|
||||||
|
|
||||||
TestSuiteCrashes.test("crashesAsExpected") {
|
|
||||||
print("crashesAsExpected")
|
|
||||||
expectCrashLater()
|
|
||||||
raiseNSException()
|
|
||||||
}
|
|
||||||
// CHECK-LABEL: stdout>>> crashesAsExpected
|
|
||||||
// CHECK: stderr>>> *** [StdlibUnittest] Terminating due to uncaught exception Trogdor: Burnination
|
|
||||||
// CHECK: stderr>>> OK: saw expected "crashed: sig
|
|
||||||
// CHECK: [ OK ] NSExceptionCrashes.crashesAsExpected
|
|
||||||
|
|
||||||
TestSuiteCrashes.test("crashesWithMessage")
|
|
||||||
.crashOutputMatches("libUnittest]")
|
|
||||||
.crashOutputMatches("Trogdor")
|
|
||||||
.crashOutputMatches("Burnination").code {
|
|
||||||
print("crashesWithMessage")
|
|
||||||
expectCrashLater()
|
|
||||||
raiseNSException()
|
|
||||||
}
|
|
||||||
// CHECK-LABEL: stdout>>> crashesWithMessage
|
|
||||||
// CHECK: stderr>>> *** [StdlibUnittest] Terminating due to uncaught exception Trogdor: Burnination
|
|
||||||
// CHECK: stderr>>> OK: saw expected "crashed: sig
|
|
||||||
// CHECK: [ OK ] NSExceptionCrashes.crashesWithMessage
|
|
||||||
|
|
||||||
TestSuiteCrashes.test("nonNSException")
|
|
||||||
.crashOutputMatches("countryside").code {
|
|
||||||
print("nonNSException")
|
|
||||||
expectCrashLater()
|
|
||||||
objc_exception_throw("countryside")
|
|
||||||
}
|
|
||||||
// CHECK-LABEL: stdout>>> nonNSException
|
|
||||||
// CHECK: stderr>>> *** [StdlibUnittest] Terminating due to uncaught exception: countryside
|
|
||||||
// CHECK: stderr>>> OK: saw expected "crashed: sig
|
|
||||||
// CHECK: [ OK ] NSExceptionCrashes.nonNSException
|
|
||||||
|
|
||||||
// CHECK: NSExceptionCrashes: Some tests failed, aborting
|
|
||||||
// CHECK: abort()
|
|
||||||
|
|
||||||
runAllTests()
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user