Commit Graph

3633 Commits

Author SHA1 Message Date
Patrick Pijnappel
2cce7dbb29 [stdlib] Remove iterator post-nil checks from UTF validation tests 2016-07-05 20:49:13 +10:00
practicalswift
d502529fe7 [swiftc] Add 💥 case (😢 → 55, 😀 → 5099) triggered in swift::Type::transform(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2049: auto swift::ArchetypeBuilder::mapTypeIntoContext(Module *, swift::GenericParamList *, swift::Type, swift::LazyResolver *)::(anonymous class)::operator()(swift::Type) const: Assertion `genericParamsDepth >= depth' failed.
9  swift           0x0000000001123b74 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 36
10 swift           0x0000000001123e10 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 704
11 swift           0x0000000000fefeeb swift::ArchetypeBuilder::mapTypeIntoContext(swift::ModuleDecl*, swift::GenericParamList*, swift::Type, swift::LazyResolver*) + 155
12 swift           0x0000000000f322e7 swift::createDesignatedInitOverride(swift::TypeChecker&, swift::ClassDecl*, swift::ConstructorDecl*, swift::DesignatedInitKind) + 119
13 swift           0x0000000000eb8173 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 3187
18 swift           0x0000000000eb1ef6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
21 swift           0x0000000000f182ea swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
22 swift           0x0000000000f1814e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
23 swift           0x0000000000f18d13 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
25 swift           0x0000000000ed4201 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
26 swift           0x0000000000c61489 swift::CompilerInstance::performSema() + 3289
28 swift           0x00000000007d82c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
29 swift           0x00000000007a4308 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28344-swift-type-transform.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28344-swift-type-transform-510b91.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28344-swift-type-transform.swift:10:1
2.	While type-checking 'A' at validation-test/compiler_crashers/28344-swift-type-transform.swift:10:8
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-05 10:45:32 +02:00
Slava Pestov
5a902935e8 Sema: Explicitly set interface type on all AbstractFunctionDecls
Previously getInterfaceType() would punt to getType() if no
interface type was set. This patch changes getInterfaceType()
to assert if no interface type is set, and updates various
places to set the interface type explicitly.

This brings us a step closer to removing PolymorphicFunctionType.
2016-07-05 00:24:28 -07:00
practicalswift
3c3e87268d [swiftc] Add 💥 case (😢 → 55, 😀 → 5098) triggered in swift::GenericFunctionType::get(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/ASTContext.cpp:3041: static swift::GenericFunctionType *swift::GenericFunctionType::get(swift::GenericSignature *, swift::Type, swift::Type, const swift::AnyFunctionType::ExtInfo &): Assertion `!input->hasTypeVariable() && !output->hasTypeVariable()' failed.
8  swift           0x00000000010064db swift::GenericFunctionType::get(swift::GenericSignature*, swift::Type, swift::Type, swift::AnyFunctionType::ExtInfo const&) + 603
9  swift           0x00000000011251e3 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 5747
10 swift           0x0000000001125be8 swift::TypeBase::getTypeOfMember(swift::ModuleDecl*, swift::Type, swift::DeclContext const*) + 136
14 swift           0x0000000000f62209 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
15 swift           0x0000000000f67b8e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
16 swift           0x0000000000e99d32 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 850
17 swift           0x0000000000ea0492 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
19 swift           0x0000000000f64652 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 9394
20 swift           0x0000000000f67b8e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
21 swift           0x0000000000e99d32 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 850
22 swift           0x0000000000ea0492 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
23 swift           0x0000000000ea1647 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
24 swift           0x0000000000ea185b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
27 swift           0x0000000000eb1ef6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
30 swift           0x0000000000f19664 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
31 swift           0x0000000000f4599c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
32 swift           0x0000000000ea0531 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
35 swift           0x0000000000f182ea swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
36 swift           0x0000000000f1814e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
37 swift           0x0000000000f18d13 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
39 swift           0x0000000000ed4201 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
40 swift           0x0000000000c61489 swift::CompilerInstance::performSema() + 3289
42 swift           0x00000000007d82c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
43 swift           0x00000000007a4308 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28343-swift-genericfunctiontype-get-849f66.o
1.	While type-checking getter for a at validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift:13:6
2.	While type-checking expression at [validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift:13:7 - line:14:8] RangeText="{
3.	While type-checking declaration 0x58b5180 at validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift:14:1
4.	While type-checking expression at [validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift:14:7 - line:14:8] RangeText="p{"
5.	While type-checking expression at [validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift:14:7 - line:14:8] RangeText="p{"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-04 23:10:57 +02:00
practicalswift
ad578e89c1 Flag "-emit-ir" is needed to trigger crash. 2016-07-04 22:53:15 +02:00
practicalswift
bc208f5ef1 [swiftc] Add 💥 case (😢 → 56, 😀 → 5096) triggered in swift::irgen::IRGenModule::emitSILFunction(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/IRGen/GenType.cpp:84: swift::irgen::Address swift::irgen::TypeInfo::getAddressForPointer(llvm::Value *) const: Assertion `ptr->getType()->getPointerElementType() == StorageType' failed.
11 swift           0x00000000008af5e9 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 1241
12 swift           0x000000000080d028 swift::irgen::IRGenerator::emitGlobalTopLevel() + 408
14 swift           0x00000000007e6954 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 68
16 swift           0x00000000007d82c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
17 swift           0x00000000007a4308 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28342-getpointerelementtype-is-not-storagetype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28342-getpointerelementtype-is-not-storagetype-7b6cf1.o
1.	While emitting IR SIL function @_TTWV4main1HS_1ES_FS1_1guRd__S_1Awx1Fzwd__1BrfGVS_1Cqd___T_ for 'g' at validation-test/compiler_crashers/28342-getpointerelementtype-is-not-storagetype.swift:22:5
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-04 22:41:11 +02:00
swift-ci
5ca61f69fb Merge pull request #3331 from gregomni/getDeclaredType-cleanup 2016-07-03 20:03:31 -07:00
gregomni
8d02354b76 Return ErrorType for type on invalid extension
This is a better fix for crash 28328 than commit
a870bdbd23. Also fixes additional
crashers.
2016-07-03 14:05:02 -07:00
practicalswift
f5aecc2128 [swiftc] Add 💥 case (😢 → 55, 😀 → 5096) triggered in swift::TypeChecker::typeCheckDecl(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckDecl.cpp:4247: void (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl *): Assertion `!FD->getType()->hasTypeParameter()' failed.
12 swift           0x0000000000eb1ea6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
15 swift           0x0000000000f19614 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
16 swift           0x0000000000f4594c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
17 swift           0x0000000000ea04e1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
18 swift           0x0000000000ea15f7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
19 swift           0x0000000000ea180b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
21 swift           0x0000000000ead5bd swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3853
26 swift           0x00000000010e9f35 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1189
27 swift           0x0000000000eef7c1 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 305
28 swift           0x0000000000e991e9 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3865
30 swift           0x0000000001066c53 swift::Expr::walk(swift::ASTWalker&) + 19
31 swift           0x0000000000e99a70 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 224
32 swift           0x0000000000ea0442 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
33 swift           0x0000000000ea15f7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
34 swift           0x0000000000ea180b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
36 swift           0x0000000000ead5bd swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3853
37 swift           0x0000000000f31c6d swift::createImplicitConstructor(swift::TypeChecker&, swift::NominalTypeDecl*, swift::ImplicitConstructorKind) + 413
38 swift           0x0000000000eb7ab0 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1536
41 swift           0x0000000000eb1ea6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
42 swift           0x0000000000ed40b2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
43 swift           0x0000000000c61489 swift::CompilerInstance::performSema() + 3289
45 swift           0x00000000007d82c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
46 swift           0x00000000007a4308 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28341-swift-typechecker-typecheckdecl.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28341-swift-typechecker-typecheckdecl-658f4b.o
1.	While type-checking 'S' at validation-test/compiler_crashers/28341-swift-typechecker-typecheckdecl.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28341-swift-typechecker-typecheckdecl.swift:11:7 - line:11:7] RangeText="o"
3.	While type-checking expression at [validation-test/compiler_crashers/28341-swift-typechecker-typecheckdecl.swift:15:7 - line:18:8] RangeText="{
4.	While type-checking 'A' at validation-test/compiler_crashers/28341-swift-typechecker-typecheckdecl.swift:16:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-03 10:37:06 +02:00
Nate Cook
202f84e7f4 [stdlib] Update String COW tests
Removing the _StringCore reference from string indices fixes
an extra reallocation when mutating a string with heap buffer
storage.
2016-07-02 23:16:28 -05:00
Chris Lattner
87db7b4cf2 update validation tests to modern syntax. 2016-07-02 17:10:49 -07:00
swift-ci
550bb31e6f Merge pull request #3319 from practicalswift/swiftc-28340-swift-type-getstring 2016-07-02 04:50:45 -07:00
swift-ci
663884f92a Merge pull request #3318 from gregomni/crash28328 2016-07-02 02:14:08 -07:00
practicalswift
a107086667 [swiftc] Add 💥 case (😢 → 55, 😀 → 5095) triggered in swift::Type::getString(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/ASTPrinter.cpp:4061: void (anonymous namespace)::TypePrinter::visitArchetypeType(swift::ArchetypeType *): Assertion `GTD && GTD->isProtocolSelf()' failed.
12 swift           0x0000000001037313 swift::Type::getString(swift::PrintOptions const&) const + 163
13 swift           0x0000000000f62ad4 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 2244
14 swift           0x0000000000f67bfe swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
15 swift           0x0000000000e9a3c2 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 850
16 swift           0x0000000000ea0b22 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
17 swift           0x0000000000ea1cd7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
18 swift           0x0000000000ea1eeb swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
20 swift           0x0000000000eb25a6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
23 swift           0x0000000000f1888a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
24 swift           0x0000000000f186ee swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
25 swift           0x0000000000f192b3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
27 swift           0x0000000000ed4851 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
28 swift           0x0000000000c62209 swift::CompilerInstance::performSema() + 3289
30 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
31 swift           0x00000000007a49f8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28340-swift-type-getstring.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28340-swift-type-getstring-e49a2a.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28340-swift-type-getstring.swift:18:1
2.	While type-checking declaration 0x4e90678 at validation-test/compiler_crashers/28340-swift-type-getstring.swift:18:8
3.	While type-checking expression at [validation-test/compiler_crashers/28340-swift-type-getstring.swift:18:14 - line:18:14] RangeText="1"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-02 11:06:39 +02:00
gregomni
a870bdbd23 Fix for crash 28328. A decl's computeNominalType() can return null, but a bunch of places expect getDeclaredTypeInContext() to never be null so use ErrorType instead. 2016-07-01 23:35:03 -07:00
practicalswift
611c6f577c [swiftc] Add 💥 case (😢 → 54, 😀 → 5095) triggered in swift::TypeChecker::addImplicitConstructors(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckDecl.cpp:7344: void swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl *): Assertion `!classDecl->hasSuperclass() || classDecl->getSuperclass()->getAnyNominal()->isInvalid() || classDecl->getSuperclass()->getAnyNominal() ->addedImplicitInitializers()' failed.
8  swift           0x0000000000eb8d5a swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 4506
9  swift           0x0000000000eabbed swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5885
10 swift           0x0000000000eacf28 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 376
15 swift           0x0000000000eb25a6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
18 swift           0x0000000000f1888a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
19 swift           0x0000000000f186ee swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
20 swift           0x0000000000f192b3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
22 swift           0x0000000000ed4851 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
23 swift           0x0000000000c62209 swift::CompilerInstance::performSema() + 3289
25 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
26 swift           0x00000000007a49f8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28339-swift-typechecker-addimplicitconstructors.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28339-swift-typechecker-addimplicitconstructors-bd822a.o
1.	While type-checking getter for d at validation-test/compiler_crashers/28339-swift-typechecker-addimplicitconstructors.swift:10:6
2.	While type-checking 'A' at validation-test/compiler_crashers/28339-swift-typechecker-addimplicitconstructors.swift:10:7
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-02 06:42:06 +02:00
Michael Gottesman
3c603ab18b Merge remote-tracking branch 'origin/master' into master-next 2016-07-01 18:44:21 -07:00
Harlan
1625d97976 Switch to llvm-profdata's pooled profdata merge (#3281) 2016-07-01 16:45:21 -07:00
Dmitri Gribenko
2080426d70 Merge pull request #3291 from practicalswift/syntax-fixes-20160701
[gardening] Don't compare with false
2016-07-01 16:25:16 -07:00
swift-ci
2aeed65973 Merge pull request #3276 from uraimo/tioc-patch 2016-07-01 16:05:14 -07:00
swift-ci
0d330a0419 Merge pull request #3292 from practicalswift/typo-fixes-20160701 2016-07-01 15:16:16 -07:00
swift-ci
633aee5f42 Merge pull request #3295 from practicalswift/swiftc-28338-swift-genericsignature-getsubstitutionmap 2016-07-01 15:14:31 -07:00
Umberto Raimondi
bd1a6aeb01 stdlib: added Tty ioctl constants for Darwin/FreeBSD 2016-07-01 17:00:04 -04:00
swift-ci
f235a626fd Merge pull request #3221 from compnerd/ps4 2016-07-01 12:34:24 -07:00
swift-ci
dfe73180b5 Merge pull request #3297 from gregomni/crash28290 2016-07-01 11:41:11 -07:00
gregomni
27b7420fff Fix for crash 28290 in findGenericSubstitutions
Early out needs to check that the types don’t contain UnresolvedType,
not just that they aren’t UnresolvedType at the top level.
2016-07-01 10:48:50 -07:00
practicalswift
dd93d551df [gardening] Fix recently introduced typos 2016-07-01 19:28:34 +02:00
practicalswift
9d9141ee5a [swiftc] Add 💥 case (😢 → 54, 😀 → 5094) triggered in swift::GenericSignature::getSubstitutionMap(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/GenericSignature.cpp:413: TypeSubstitutionMap swift::GenericSignature::getSubstitutionMap(ArrayRef<swift::Substitution>) const: Assertion `args.empty() && "did not use all substitutions?!"' failed.
8  swift           0x00000000010e5f63 swift::GenericSignature::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const + 659
9  swift           0x0000000000f32442 swift::createDesignatedInitOverride(swift::TypeChecker&, swift::ClassDecl*, swift::ConstructorDecl*, swift::DesignatedInitKind) + 338
10 swift           0x0000000000eb8833 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 3187
19 swift           0x0000000000eb25a6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
23 swift           0x0000000000f19d46 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
24 swift           0x0000000000ed47bd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
25 swift           0x0000000000c62209 swift::CompilerInstance::performSema() + 3289
27 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
28 swift           0x00000000007a49f8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28338-swift-genericsignature-getsubstitutionmap.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28338-swift-genericsignature-getsubstitutionmap-62e861.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28338-swift-genericsignature-getsubstitutionmap.swift:11:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-01 19:08:58 +02:00
practicalswift
6b5e688680 [gardening] Don't compare with false 2016-07-01 17:03:31 +02:00
practicalswift
40f8408b07 [swiftc] Add 💥 case (😢 → 53, 😀 → 5094) triggered in swift::TypeBase::getCanonicalType(…)
Add crash case with stack trace:

```
4  swift           0x000000000111aff4 swift::TypeBase::getCanonicalType() + 20
5  swift           0x0000000001133a7d swift::ConformanceLookupTable::getConformance(swift::NominalTypeDecl*, swift::LazyResolver*, swift::ConformanceLookupTable::ConformanceEntry*) + 301
7  swift           0x0000000001134194 swift::ConformanceLookupTable::lookupConformances(swift::NominalTypeDecl*, swift::DeclContext*, swift::LazyResolver*, swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ProtocolDecl*>*, llvm::SmallVectorImpl<swift::ProtocolConformance*>*, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*) + 692
8  swift           0x00000000011167e4 swift::DeclContext::getLocalConformances(swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*, bool) const + 212
9  swift           0x0000000000ef996e swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 334
16 swift           0x0000000000eb25a6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
19 swift           0x0000000000f19c04 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
20 swift           0x0000000000f45a2c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
21 swift           0x0000000000ea0bc1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
23 swift           0x0000000000f19d46 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
24 swift           0x0000000000ed47bd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
25 swift           0x0000000000c62209 swift::CompilerInstance::performSema() + 3289
27 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
28 swift           0x00000000007a49f8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28337-swift-typebase-getcanonicaltype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28337-swift-typebase-getcanonicaltype-1d42b8.o
1.	While type-checking expression at [validation-test/compiler_crashers/28337-swift-typebase-getcanonicaltype.swift:9:1 - line:13:17] RangeText="{
2.	While type-checking 'a' at validation-test/compiler_crashers/28337-swift-typebase-getcanonicaltype.swift:10:1
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-01 15:18:14 +02:00
Slava Pestov
95bc009e3e Reflection: Multi-payload enum layout
The approach here is to split this into two cases:

- If all case payloads have a fixed size, spare bits may be
  potentially used to differentiate between cases, and the
  remote reflection library does not have enough information to
  compute the layout itself.

  However, the total size must be fixed, so IRGen just emits a
  builtin type descriptor (which I need to rename to 'fixed type
  descriptor' since these are also used for imported value types,
  and now, certain enums).

- If at least one case has a size that depends on a generic
  parameter or is a resilient type, IRGen does not know the size,
  but this means fancy tricks with spare bits cannot be used either.
  The remote reflection library uses the same approach as the
  runtime, basically taking the maximum of the payload size and
  alignment, and adding a tag byte.

As with single-payload enums, we produce a new kind of
RecordTypeInfo, this time with a field for every enum case.
All cases start at offset zero (but of course this might change,
if for example we put the enum tag before the address point).

Also, just as with single-payload enums, there is no remote
'project case index' operation on ReflectionContext yet.

So the the main benefit from this change is that we don't entirely
give up when doing layout of class instances containing enums;
however, tools still cannot look inside the enum values themselves,
except in the simplest cases involving optionals.

Notably, the remote reflection library finally understands all
of the standard library's collection types -- Array, Character,
Dictionary, Set, and String.
2016-07-01 01:31:25 -07:00
Saleem Abdulrasool
83901998c9 Port for PS4
Add support for the PS4 OS.  Update the standard library and add a target unit
test.
2016-06-30 20:14:50 -07:00
Max Moiseev
4bbecbac75 Skip the test failing in the optimized mode 2016-06-30 17:15:51 -07:00
Slava Pestov
48c928938a Reflection: Single-payload enum layout
Attempt to lay out single-payload enums, using knowledge of extra
inhabitants where possible.

- The extra inhabitants of an aggregate are the extra inhabitants of
  the first field. If the first field is empty, there are no extra
  inhabitants, and subsequent fields do not affect anything.

- Function pointers and metatypes have different extra inhabitants
  than Builtin.RawPointer, so have IRGen emit distinct builtin type
  descriptors for those.

- Opaque existentials do not have extra inhabitants.

- Weak references do not have extra inhabitants.

Also, fix IRGen to emit more accurate enum reflection metadata in
these two cases:

- We now record whether enum cases are indirect or not. An indirect
  case is the same as a payload case with Builtin.NativeObject.

- We now record whether a case is empty or not using the same logic
  as the rest of IRGen. Previously, we would incorrectly emit a
  payload type for a case with a payload that is an empty struct,
  for example.

At this point we don't have a way to get the currently inhabited
enum case from a value. However, this is still an improvement because
we can still reflect other fields of aggregates containing enums,
instead of just giving up.

Finally make some methods on TypeCoverter private, and use 'friend'
to allow them to be accessed from other internal classes, making the
public API simpler.
2016-06-30 12:57:14 -06:00
Slava Pestov
d7d2ed5046 Reflection: Remove a redundant test 2016-06-30 12:57:14 -06:00
practicalswift
8f89865e32 [swiftc] Add 💥 case (😢 → 52, 😀 → 5094) triggered in swift::ArchetypeBuilder::addRequirement(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:1476: void swift::ArchetypeBuilder::addRequirement(const swift::Requirement &, swift::RequirementSource): Assertion `pa && "Re-introducing invalid requirement"' failed.
8  swift           0x0000000000fee5fb swift::ArchetypeBuilder::addRequirement(swift::Requirement const&, swift::RequirementSource) + 667
9  swift           0x0000000000ff01c3 swift::ArchetypeBuilder::addGenericSignature(swift::GenericSignature*, bool, bool) + 515
10 swift           0x0000000000ffcc45 swift::ASTContext::getOrCreateArchetypeBuilder(swift::CanGenericSignature, swift::ModuleDecl*) + 181
11 swift           0x00000000010e693b swift::GenericSignature::getCanonicalTypeInContext(swift::Type, swift::ModuleDecl&) + 43
12 swift           0x000000000111b56d swift::TypeBase::getCanonicalType() + 1421
17 swift           0x00000000010e9f26 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1174
18 swift           0x0000000000eefd44 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 260
19 swift           0x0000000000e998c9 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3881
21 swift           0x0000000001066c43 swift::Expr::walk(swift::ASTWalker&) + 19
22 swift           0x0000000000e9a150 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 224
23 swift           0x0000000000ea0b22 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
26 swift           0x0000000000f1888a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
27 swift           0x0000000000f186ee swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
28 swift           0x0000000000f192b3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
30 swift           0x0000000000ed4851 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
31 swift           0x0000000000c62209 swift::CompilerInstance::performSema() + 3289
33 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
34 swift           0x00000000007a49f8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28336-swift-archetypebuilder-addrequirement.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28336-swift-archetypebuilder-addrequirement-728e64.o
1.	While type-checking 'g' at validation-test/compiler_crashers/28336-swift-archetypebuilder-addrequirement.swift:10:40
2.	While type-checking expression at [validation-test/compiler_crashers/28336-swift-archetypebuilder-addrequirement.swift:10:49 - line:10:49] RangeText="c"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-30 13:21:30 +02:00
swift-ci
8f7356f518 Merge pull request #3275 from apple/stdlib-add-persistent-vector-prototype 2016-06-30 03:25:57 -07:00
rjmccall
aa0b05c1a0 Merge pull request #3271 from rjmccall/fix-lookupVisibleDecls-in-AutoClosureExpr
Fix lookupVisibleDecls from inside an AutoClosureExpr.
2016-06-30 01:28:06 -07:00
Dmitri Gribenko
b8ba955198 stdlib: add a prototype implementation of a persistent vector 2016-06-30 00:49:02 -07:00
Dmitri Gribenko
8507deccb7 stdlib: simplify test organization in FloatingPointConversion.swift.gyb 2016-06-29 23:21:22 -07:00
Dmitri Gribenko
3658d14389 stdlib: simplify tests for conversions of special floating point values 2016-06-29 22:41:09 -07:00
Doug Gregor
423c1f09da [Type checker] Use call argument matching even with type variables on the left-hand side.
Rather than using a specialized matching rule in the type checker that
depends on having default arguments in types, use call argument
matching consistently.

Note #1: This (correctly) breaks some existing code that depends on
inferring a parameter type of () for a single-argument parameter from
a no-argument function type().

Note #2: This pessimizes a code completion test, where the code
completion engine seems to depend on some quirks of argument
matching. The "type relationship" matching needs non-trivial work.
2016-06-29 20:43:42 -07:00
swift-ci
8fe85c3368 Merge pull request #2977 from ultramiraculous/failable-float-float 2016-06-29 20:30:11 -07:00
John McCall
f59c16faac Fix lookupVisibleDecls from inside an AutoClosureExpr. 2016-06-29 19:06:36 -07:00
swift-ci
7ffba2162f Merge pull request #3264 from austinzheng/az-tests2 2016-06-29 18:44:17 -07:00
swift-ci
49b365429e Merge pull request #3260 from practicalswift/swiftc-28335-swift-type-print 2016-06-29 17:25:18 -07:00
Chris Williams
025a69988d Float->Float Failable Initializer Tests 2016-06-29 16:23:32 -07:00
rjmccall
4ba74a2c69 Merge pull request #3262 from rjmccall/fix-recordImportDecls-signature-resolution
Check for lazy signature resolution failure when deciding overloadabi…
2016-06-29 16:17:52 -07:00
Austin Zheng
aec2d8ea0b [stdlib] Add tests for UnsafeMutableBufferPointer subscript setter 2016-06-29 14:59:16 -07:00
Austin Zheng
26ade958c3 [stdlib] Fix UnsafeBufferPointer range subscript getter tests (#3233)
All four of the Unsafe*BufferPointer range subscript getter tests (one for each range) were using the same test name string. This caused only one of the four tests to actually be registered to the test suite. This change fixes that issue, and adds a couple more tests for better coverage.
2016-06-29 13:56:57 -07:00