Commit Graph

7859 Commits

Author SHA1 Message Date
Dave Abrahams
a95cea9868 Merge branch 'swift-3-indexing-model' of github.com:apple/swift into swift-3-indexing-model 2016-03-28 13:35:30 -07:00
Dave Abrahams
da5c4036ac func index(n: IndexDistance, stepsFrom i: Index)
M-x findr-query-replace

\<func advance(\([^(),]*\|[^(),]+([^()]*)[^(),]*\)\(,[
]*\)by \([^(),]*\|[^(),]+([^()]*)[^(),]*\)

func index(\3\2stepsFrom \1
2016-03-28 13:23:04 -07:00
Dave Abrahams
81d3e8ca83 limit: => limitedBy:, pt 2
M-x findr-query-replace

\<limit: \([^(),]*\|[^(),]+([^()]*)[^(),]*\))\( *\(?:[^ -]\|-[^>]\)\)

limitedBy: \1)\2
2016-03-28 13:12:02 -07:00
Joe Groff
4e06de4975 Merge pull request #1816 from jckarter/import-lightweight-objc-generics
Import lightweight objc generics
2016-03-28 12:59:16 -07:00
Joe Groff
37dce05803 This validation-test no longer crashes. 2016-03-28 09:50:30 -07:00
practicalswift
fc333ba4fe [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::finalize(swift::SourceLoc)
Stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:1683: swift::Identifier typoCorrectNestedType(ArchetypeBuilder::PotentialArchetype *): Assertion `dist > 0 && "nested type should have matched associated type"' failed.
8  swift           0x0000000000f940a1 swift::ArchetypeBuilder::finalize(swift::SourceLoc) + 2209
9  swift           0x0000000000ea4c07 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 183
10 swift           0x0000000000ea4f76 swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 102
11 swift           0x0000000000e682cf swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 367
12 swift           0x00000000010abe8c swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3612
13 swift           0x00000000010aa550 swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2400
14 swift           0x0000000000ea714b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
15 swift           0x0000000000e53e26 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 102
17 swift           0x0000000001009f13 swift::Expr::walk(swift::ASTWalker&) + 19
18 swift           0x0000000000e5541d 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>) + 125
19 swift           0x0000000000e5bc00 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 576
20 swift           0x0000000000e5cdc2 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 162
21 swift           0x0000000000e5cf9b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
26 swift           0x0000000000e6dc66 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
27 swift           0x0000000000e909c2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 994
28 swift           0x0000000000cd4cff swift::CompilerInstance::performSema() + 3087
30 swift           0x000000000078ee8c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
31 swift           0x0000000000789915 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28283-swift-archetypebuilder-finalize.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28283-swift-archetypebuilder-finalize-cbd0df.o
1.	While type-checking declaration 0x6784470 at validation-test/compiler_crashers/28283-swift-archetypebuilder-finalize.swift:11:14
2.	While type-checking expression at [validation-test/compiler_crashers/28283-swift-archetypebuilder-finalize.swift:12:7 - line:12:7] RangeText="B"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-28 10:18:19 +02:00
practicalswift
ea600a3623 [swiftc] Add test case for crash triggered in swift::constraints::Solution::coerceToType(swift::Expr*, swift::Type, swift::constraints::ConstraintLocator*, bool) const
Stack trace:

```
6  swift           0x00000000031374dd llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
8  swift           0x0000000000efa916 swift::constraints::Solution::coerceToType(swift::Expr*, swift::Type, swift::constraints::ConstraintLocator*, bool) const + 326
10 swift           0x0000000000e5bd47 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 903
11 swift           0x0000000000e5cdc2 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 162
12 swift           0x0000000000e5cf9b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
15 swift           0x0000000000e6dc66 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
18 swift           0x0000000000ecd42a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
19 swift           0x0000000000ef759c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
20 swift           0x0000000000e5bcaa swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 746
21 swift           0x0000000000e5cdc2 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 162
22 swift           0x0000000000e5cf9b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
27 swift           0x0000000000e6dc66 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
28 swift           0x0000000000e909c2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 994
29 swift           0x0000000000cd4cff swift::CompilerInstance::performSema() + 3087
31 swift           0x000000000078ee8c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
32 swift           0x0000000000789915 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28282-swift-constraints-solution-coercetotype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28282-swift-constraints-solution-coercetotype-a03df3.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28282-swift-constraints-solution-coercetotype.swift:9:1
2.	While type-checking expression at [validation-test/compiler_crashers/28282-swift-constraints-solution-coercetotype.swift:9:15 - line:10:10] RangeText="(T:{var f:a
3.	While type-checking declaration 0x67a9c78 at validation-test/compiler_crashers/28282-swift-constraints-solution-coercetotype.swift:10:1
4.	While type-checking expression at [validation-test/compiler_crashers/28282-swift-constraints-solution-coercetotype.swift:10:7 - line:10:10] RangeText="(T:f"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-28 00:56:57 +02:00
Ted Kremenek
3c988c7d25 Remove fixed seed, as apparently it causes a crash. Will investigate more. 2016-03-26 09:17:38 -07:00
Ted Kremenek
a2d775401e Fix seed in Hashing.swift test. 2016-03-26 08:57:41 -07:00
Ted Kremenek
5c1806e2ab Change test to run, but disabled under ASan. 2016-03-26 08:51:27 -07:00
Ted Kremenek
19b0a09f05 Try to *really* disable tests by moving them out of the same folder. 2016-03-26 08:20:37 -07:00
Ted Kremenek
dcc093f179 Try and disable these two tests for real. 2016-03-26 07:55:41 -07:00
Ted Kremenek
4a0d52420d Merge pull request #1858 from practicalswift/swiftc-28281-swift-typechecker-resolvewitness
[swiftc] Add test case for crash triggered in swift::TypeChecker::resolveWitness(…)
2016-03-25 20:57:11 -07:00
Ted Kremenek
59f96454c9 Note that test is disabled due to ASan failure, tracked by SR-1070. 2016-03-25 18:48:51 -07:00
Ted Kremenek
f202ffac77 Temporarily disable testing '28277-swift-archetypebuilder-getgenericsignature.swift' because of ASan failure. 2016-03-25 18:41:58 -07:00
Dave Abrahams
01127b32d5 index(n, stepsFrom: i)
M-x findr-query-replace

\<advance(\([^:]+?\),\([
]+\)by: *\([^(),]*\|[^(),]+([^()]*)[^(),]*\)\(,\(?:[
]+\)limit: *\(?:[^()]*\|[^()]+([^()]*)[^()]*\)\)?)

index(\3,\2stepsFrom: \1\4)
2016-03-25 17:54:39 -07:00
practicalswift
d00a5ef814 [gardening] Weekly gardening: typos, duplicate includes, header formatting, etc. 2016-03-24 22:41:10 +01:00
practicalswift
cd3c285d0e [swiftc] Add test case for crash triggered in swift::TypeChecker::resolveWitness(swift::NormalProtocolConformance const*, swift::ValueDecl*)
Stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckProtocol.cpp:1826: swift::Substitution getArchetypeSubstitution(swift::TypeChecker &, swift::DeclContext *, swift::ArchetypeType *, swift::Type): Assertion `!resultReplacement->isTypeParameter() && "Can't be dependent"' failed.
11 swift           0x0000000000e9ed19 swift::TypeChecker::resolveWitness(swift::NormalProtocolConformance const*, swift::ValueDecl*) + 569
12 swift           0x00000000010a2ddb swift::NormalProtocolConformance::getWitness(swift::ValueDecl*, swift::LazyResolver*) const + 171
14 swift           0x0000000000e95784 swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 404
15 swift           0x0000000000e41e46 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 102
17 swift           0x0000000000ff81f3 swift::Expr::walk(swift::ASTWalker&) + 19
18 swift           0x0000000000e4343d 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>) + 125
19 swift           0x0000000000e49c20 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 576
22 swift           0x0000000000eba65a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
23 swift           0x0000000000eba4be swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
24 swift           0x0000000000ebb058 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 136
26 swift           0x0000000000e7f034 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1268
27 swift           0x0000000000ccf8bf swift::CompilerInstance::performSema() + 3087
29 swift           0x000000000078e52c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
30 swift           0x0000000000788fb5 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28281-swift-typechecker-resolvewitness.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28281-swift-typechecker-resolvewitness-f2097b.o
1.	While type-checking getter for a at validation-test/compiler_crashers/28281-swift-typechecker-resolvewitness.swift:17:6
2.	While type-checking expression at [validation-test/compiler_crashers/28281-swift-typechecker-resolvewitness.swift:18:1 - line:18:1] RangeText="b"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-24 21:22:00 +01:00
Max Moiseev
e7511620cf [stdlib][swift-3-indexing-model] adding a tag to find and fix the skipped test later 2016-03-24 10:24:25 -07:00
Slava Pestov
37c461cc59 Serialization: Serialize shared thunks referenced from fragile functions
If a thunk is referenced from two different functions, the thunk inherits
the fragile attribute from the first function that forced it to be emitted.

This is wrong, in case the first function might not be fragile, while
the second one is. Copying the fragile attribute to an existing thunk when
checking if it has already been emitted is also wrong, because the thunk
might reference another thunk, and so on.

The correct fix is to have SIL serialization serialize the transitive
closure of all fragile functions and thunks referenced from fragile
functions. Re-work SIL function serialization to use a worklist so that
we can do this.

Part of https://bugs.swift.org/browse/SR-267.
2016-03-24 00:50:40 -07:00
Slava Pestov
3e2d7d40e0 SIL: Serialize bodies of local functions inside @_transparent functions
A transparent function might be deserialized and inlined into a function
in another module, which would cause problems if the function referenced
local functions.

Previously we would force local functions to have public linkage instead,
which worked, but was not resilient if the body of the transparent
function changed in the module that contained it.

Add a library evolution test ensuring that such a change is resilient
now.

Part of https://bugs.swift.org/browse/SR-267.
2016-03-24 00:50:39 -07:00
Greg Titus
cce950705a Merge pull request #1699 from gregomni/typealias
[SR-938][AST/Sema] Typealias in protocol extension, spurious conformance failure fixes
2016-03-23 18:54:18 -07:00
Max Moiseev
d721a03d90 [stdlib][swift-3-indexing-model] fixing Index tests 2016-03-23 16:07:20 -07:00
Jordan Rose
11f071de9e [test] Handle StdlibUnittest built with -sil-serialize-all.
...one of our strategies to increase test coverage, which necessitates
some unfortunate workarounds for gaps in the compiler.
2016-03-23 11:23:56 -07:00
gregomni
e17e7ab8ae Make resolveTypeInContext for aliases just use interface type as dependent member.
Much cleane. Also fixes one more validation crasher.
2016-03-22 23:13:10 -07:00
Dave Abrahams
8d9e62b274 [stdlib] indexing model: rename next/previous
I'm not too satisfied with the names for the updating: versions, but
this is a start.
2016-03-22 17:13:54 -07:00
Jordan Rose
cd9114423a Reapply "[StdlibUnittest] Install our own handler for uncaught ObjC exceptions."
This reapplies e6a519f and 86dcce1 by reverting e86d3bd, which reverted
more than it needed to.
2016-03-22 16:24:40 -07:00
Max Moiseev
303ddac014 [stdlib][swift-3-indexing-model] fixing ExistentialCollection tests 2016-03-22 16:18:15 -07:00
Max Moiseev
6e76935b33 [stdlib][swift-3-indexing-model] fixing more tests
Algorithm and SequenceWrapperTest
2016-03-22 15:04:29 -07:00
Dmitri Gribenko
168e7e41a5 Merge pull request #1525 from PatrickPijnappel/utf8-rewrite
[stdlib] Rewrite UTF8 decoding
2016-03-22 14:24:11 -07:00
Max Moiseev
5713a6b608 [stdlib][swift-3-indexing-model] fixing stdlib/Generator tests 2016-03-22 12:42:33 -07:00
Max Moiseev
a43a46c8ba [stdlib][swift-3-indexing-model] making Dictionary validation tests pass 2016-03-22 12:05:22 -07:00
practicalswift
082c530743 [swiftc] Add test case for crash triggered in swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*)
Stack trace:

```
swift: /path/to/swift/include/swift/AST/DiagnosticEngine.h:610: swift::InFlightDiagnostic swift::DiagnosticEngine::diagnose(swift::SourceLoc, Diag<ArgTypes...>, typename detail::PassArgument<ArgTypes>::type...) [ArgTypes = <swift::Identifier>]: Assertion `!ActiveDiagnostic && "Already have an active diagnostic"' failed.
12 swift           0x0000000000ebe50e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
14 swift           0x0000000000ebf424 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
15 swift           0x0000000000ebe40a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
16 swift           0x0000000000f763cf swift::IterativeTypeChecker::processResolveInheritedClauseEntry(std::pair<llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, unsigned int>, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 159
17 swift           0x0000000000f53a5d swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
18 swift           0x0000000000e50a39 swift::TypeChecker::resolveInheritanceClause(llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>) + 137
19 swift           0x00000000010bb6f3 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 2435
20 swift           0x00000000010bae68 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 248
21 swift           0x00000000010be272 swift::ConformanceLookupTable::lookupConformance(swift::ModuleDecl*, swift::NominalTypeDecl*, swift::ProtocolDecl*, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ProtocolConformance*>&) + 50
22 swift           0x0000000001085a51 swift::ModuleDecl::lookupConformance(swift::Type, swift::ProtocolDecl*, swift::LazyResolver*) + 1137
23 swift           0x0000000000e9b40a swift::TypeChecker::conformsToProtocol(swift::Type, swift::ProtocolDecl*, swift::DeclContext*, swift::OptionSet<swift::ConformanceCheckFlags, unsigned int>, swift::ProtocolConformance**, swift::SourceLoc) + 106
27 swift           0x0000000000e5f312 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1442
32 swift           0x0000000000e59776 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000e7caaa swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1146
34 swift           0x0000000000ccd3cf swift::CompilerInstance::performSema() + 3087
36 swift           0x000000000078e10c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
37 swift           0x0000000000788b85 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28280-swift-typechecker-resolveidentifiertype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28280-swift-typechecker-resolveidentifiertype-6143c3.o
1.	While type-checking 'T' at validation-test/compiler_crashers/28280-swift-typechecker-resolveidentifiertype.swift:10:1
2.	While resolving type A at [validation-test/compiler_crashers/28280-swift-typechecker-resolveidentifiertype.swift:10:38 - line:10:38] RangeText="A"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-22 20:00:14 +01:00
Max Moiseev
cf92a80830 [stdlib][swift-3-indexing-model] making Set validation tests pass 2016-03-22 11:57:05 -07:00
gregomni
45fa88c72d [AST/Sema] Typealias in protocol further corner fixes.
Don’t try to find a conformation witness for typealias declarations in
protocols.

Fixed a bug with same type constraint between an alias and a concrete
type - just a bad assumption on my part. Added test for that.

Made archetype builder more resilient in constructing PA trees: it will
work correctly now if the alias destination is a dependent member type
instead of an archetype type. It also handles the case of finding
multiple aliases with the same name along with an associatedtype with
that name, fixing up all the representative ptrs.

Extensions/Nominals that tried to use a protocol's typealias would get a
dependent type as resolved with the protocol's base instead of with the 'Self'
base type of the current extension/nominal, resulting in spurious conformance
failures. So resolve aliases to protocol assoctypes based on the 'Self'
in which they are used.

Also fixed tests to not use common stdlib names, added tests for
typealias in protocol extension and self & recursive aliases. One recent
crasher also fixed.
2016-03-22 07:36:16 -07:00
Dmitri Gribenko
8f48d85d9e Array tests: split Objective-C-independent tests into a new file
And also merge the small test/1_stdlib/ArrayCore.swift test into it.
2016-03-21 23:27:03 -07:00
Michael Gottesman
8f61c053c1 Merge pull request #1761 from frootloops/do
Replace if true with do
2016-03-21 15:17:33 -07:00
Dmitri Gribenko
a6cd57222a Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-03-21 14:41:15 -07:00
Arsen Gasparyan
9dbf4c99c8 Replace if true with do 2016-03-21 23:01:48 +03:00
Ben Langmuir
78e2e59351 [IDE] Fix crasher 063-swift-generictypeparamtype-get.swift
This test was crashing (except under asan) because we were using dead
pointers to stack memory where a TypeChecker used to live.
2016-03-21 11:39:43 -07:00
Ted Kremenek
67703b91b8 Merge pull request #1750 from practicalswift/swiftc-28279-swift-archetypebuilder-potentialarchetype-getnestedtype
[swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::PotentialArchetype::getNestedType(…)
2016-03-20 21:02:59 -07:00
Michael Ilseman
e86d3bde6c 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.
2016-03-20 20:00:37 -07:00
practicalswift
2b563d8243 [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::PotentialArchetype::getNestedType(swift::Identifier, swift::ArchetypeBuilder&)
Stack trace:

```
4  swift           0x0000000000f72f8d swift::ArchetypeBuilder::PotentialArchetype::getNestedType(swift::Identifier, swift::ArchetypeBuilder&) + 797
5  swift           0x0000000000f75bec swift::ArchetypeBuilder::addConformanceRequirement(swift::ArchetypeBuilder::PotentialArchetype*, swift::ProtocolDecl*, swift::RequirementSource, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&) + 444
6  swift           0x0000000000f77fed swift::ArchetypeBuilder::addRequirement(swift::Requirement const&, swift::RequirementSource) + 317
7  swift           0x0000000000f79ce3 swift::ArchetypeBuilder::addGenericSignature(swift::GenericSignature*, bool, bool) + 515
8  swift           0x0000000000e899c7 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, bool, swift::GenericTypeResolver*) + 55
10 swift           0x0000000000e89efc swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 124
13 swift           0x0000000000e53c86 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
14 swift           0x0000000000ec3423 swift::convertStoredVarInProtocolToComputed(swift::VarDecl*, swift::TypeChecker&) + 115
19 swift           0x0000000000e53c86 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
22 swift           0x0000000000eb3a2a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
23 swift           0x0000000000edd9fc swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
24 swift           0x0000000000e41c9a swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 746
26 swift           0x0000000000eb3b76 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
27 swift           0x0000000000e76fad swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1117
28 swift           0x0000000000cc865f swift::CompilerInstance::performSema() + 3087
30 swift           0x000000000078d3ac frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
31 swift           0x0000000000787e25 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28279-swift-archetypebuilder-potentialarchetype-getnestedtype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28279-swift-archetypebuilder-potentialarchetype-getnestedtype-b5cbd1.o
1.	While type-checking expression at [validation-test/compiler_crashers/28279-swift-archetypebuilder-potentialarchetype-getnestedtype.swift:9:1 - line:15:11] RangeText="{
2.	While type-checking 'A' at validation-test/compiler_crashers/28279-swift-archetypebuilder-potentialarchetype-getnestedtype.swift:10:1
3.	While type-checking getter for f at validation-test/compiler_crashers/28279-swift-archetypebuilder-potentialarchetype-getnestedtype.swift:12:5
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-20 18:56:58 +01:00
practicalswift
600259c4ce [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>)
Stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2223: void collectRequirements(swift::ArchetypeBuilder &, ArrayRef<swift::GenericTypeParamType *>, SmallVectorImpl<swift::Requirement> &): Assertion `pa && "Missing potential archetype for generic parameter"' failed.
8  swift           0x0000000000f7a3b8 swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>) + 1576
9  swift           0x0000000000e8b2d1 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 321
10 swift           0x0000000000e8b5b6 swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 102
11 swift           0x0000000000e4e7bc swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1596
12 swift           0x0000000000e4e251 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 209
15 swift           0x0000000001086632 swift::namelookup::lookupInModule(swift::ModuleDecl*, llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::DeclName, llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::NLKind, swift::namelookup::ResolutionKind, swift::LazyResolver*, swift::DeclContext const*, llvm::ArrayRef<std::pair<llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >) + 1122
16 swift           0x000000000108d95a swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 3978
17 swift           0x0000000000e8d79b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
20 swift           0x0000000000e972f0 swift::TypeChecker::inferDefaultWitnesses(swift::ProtocolDecl*) + 288
21 swift           0x0000000000e77628 swift::finishTypeChecking(swift::SourceFile&) + 504
22 swift           0x0000000000cc880a swift::CompilerInstance::performSema() + 3514
24 swift           0x000000000078d3ac frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
25 swift           0x0000000000787e25 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28278-swift-archetypebuilder-getgenericsignature.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28278-swift-archetypebuilder-getgenericsignature-ed4694.o
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-20 10:36:14 +01:00
Ted Kremenek
b6104b9cae Disable "Hashing.swift" test since it fails with some non-zero probability even when the functionality is correct.
This is causing the the test to be largely ignored, and disrupts regular testing
(including in continuous integration) where an integration can fail just
because this tests fails for "expected" reasons.

We should re-enable the test once it is has a way to tolerate the
"expected" failure, perhaps using some notion of statistical confidence
to determine if the failure is real.
2016-03-19 21:27:44 -07:00
Dmitri Gribenko
8ef59b187d Silence warnings in NewArray.swift.gyb 2016-03-19 18:07:58 -07:00
Dmitri Gribenko
3f448b3896 Move NewArray.swift.gyb to validation-test
It depends on checkRangeReplaceable, which was moved to
StdlibCollectionUnittest.
2016-03-19 18:07:50 -07:00
practicalswift
01b8296566 [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>)
Stack trace:

```
swift: /path/to/llvm/include/llvm/ADT/TinyPtrVector.h:182: EltTy llvm::TinyPtrVector<swift::ArchetypeBuilder::PotentialArchetype *>::front() const [EltTy = swift::ArchetypeBuilder::PotentialArchetype *]: Assertion `!empty() && "vector empty"' failed.
10 swift           0x0000000000f78281 swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>) + 1089
11 swift           0x0000000000e885f7 swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 359
16 swift           0x0000000000e52296 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
19 swift           0x0000000000eb203a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
20 swift           0x0000000000edc00c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
21 swift           0x0000000000e401aa swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 746
23 swift           0x0000000000eb2186 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
24 swift           0x0000000000e755bd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1117
25 swift           0x0000000000cc6e2f swift::CompilerInstance::performSema() + 3087
27 swift           0x000000000078d17c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
28 swift           0x0000000000787c45 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28277-swift-archetypebuilder-getgenericsignature-82990f.o
1.	While type-checking expression at [validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift:10:1 - line:13:23] RangeText="{
2.	While type-checking 'A' at validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.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-03-19 16:46:21 +01:00
Chris Lattner
07c892c5f0 Merge pull request #1733 from practicalswift/swiftc-28276-swift-typechecker-computedefaultaccessibility
[swiftc] Add test case for crash triggered in swift::TypeChecker::computeDefaultAccessibility(…)
2016-03-19 08:29:58 -07:00
Dmitri Gribenko
aaa486cc7b New indexing model: fix most compilation issues in StdlibCollectionUnittest
We are still hitting what looks like a compiler bug:

error: type alias 'SubSequence' circularly references itself

which is emitted for every minimal collection type.
2016-03-18 23:20:57 -07:00