Commit Graph

3633 Commits

Author SHA1 Message Date
Dmitri Gribenko
e242b4a472 stdlib: implement SipHash-1-3 and SipHash-2-4 2016-09-06 20:41:03 -07:00
Slava Pestov
0c30979f47 Resolve some crashers 2016-09-06 11:52:25 -07:00
Slava Pestov
3b1721795f AST: Nuke GenericSignature::getCanonicalManglingSignature()
Now that the previous patches have shaken out implicit assumptions
about the order of generic requirements and substitutions, we can
make a more radical change, dropping redundant protocol requirements
when building the original generic signature.

This means that the canonical ordering and minimization that we
used to only perform when building the mangling signature is done
all of the time, and hence getCanonicalManglingSignature() can go
away.

Usages now either call getCanonicalSignature(), or operate on the
original signature directly.
2016-09-06 11:51:14 -07:00
Slava Pestov
f19192d498 ArchetypeBuilder: Sort requirements in enumerateRequirements()
Move the sorting algorithm from construction of the canonical mangling
signature to requirement enumeration.

This also changes how same-type constraints pick representatives, using
the more canonical total order.
2016-09-06 11:51:13 -07:00
Dmitri Gribenko
55864d10cb Tests: use 'mkdir -p' 2016-09-02 21:36:45 -07:00
Max Moiseev
9fc37efee4 [test] renaming test/1_stdlib to just test/stdlib 2016-09-01 16:51:43 -07:00
Max Moiseev
5f5de9ed5a [test] moving long stdlib tests to validation-test suite 2016-09-01 16:51:07 -07:00
Michael Gottesman
fa1bb95923 Merge remote-tracking branch 'origin/master' into master-next 2016-08-30 19:50:12 -07:00
Dave Abrahams
e41f023c99 Merge pull request #4538 from apple/stdlib-warning-suppression
[stdlib] Suppress noisy warnings
2016-08-29 07:45:01 -07:00
Dave Abrahams
5c13e35f29 [stdlib] Suppress noisy warnings
We don't have a way yet to say "this is deprecated for users, but let
the stdlib use it without complaining" so we need to do refactoring
shenanigans.
2016-08-28 15:06:42 -07:00
Slava Pestov
97d0562913 XFAIL a crasher that no longer crashes with removal of AllArchetypes
The code here should not type check, because we're adding a requirement to
an outer archetype.

I'm working on some changes to ArchetypeBuilder that will make this kind
of thing easier to catch.
2016-08-28 13:59:20 -07:00
Slava Pestov
e72808c1ce Fixed SIL crashers 2016-08-28 13:51:39 -07:00
Robert Widmann
5d21c2a425 Merge pull request #4502 from practicalswift/swiftc-28403-swift-genericsignature-getsubstitutionmap
[swiftc (56 vs. 5156)] Add crasher in swift::GenericSignature::getSubstitutionMap(...)
2016-08-25 13:01:52 -07:00
Mark Lacey
e2f7c6e23d Add known type checker crasher.
Add minimized test for rdar://problem/27830834.

In a build with asserts enabled assert with:
  (TypeVariables[impl.getGraphIndex()] == typeVar && "Type variable mismatch")
2016-08-25 11:19:49 -07:00
practicalswift
0aa73e2770 [swiftc (56 vs. 5156)] Add crasher in swift::GenericSignature::getSubstitutionMap(...)
Add test case for crash triggered in `swift::GenericSignature::getSubstitutionMap(...)`.

Current number of unresolved compiler crashers: 56 (5156 resolved)

Assertion failure in `llvm/include/llvm/ADT/ArrayRef.h (line 139)`:

```
Assertion `!empty()' failed.

When executing: const T &llvm::ArrayRef<swift::Substitution>::front() const [T = swift::Substitution]
```

Assertion context:

```
    /// size - Get the array size.
    size_t size() const { return Length; }

    /// front - Get the first element.
    const T &front() const {
      assert(!empty());
      return Data[0];
    }

    /// back - Get the last element.
    const T &back() const {
```
Stack trace:

```
swift: /path/to/llvm/include/llvm/ADT/ArrayRef.h:139: const T &llvm::ArrayRef<swift::Substitution>::front() const [T = swift::Substitution]: Assertion `!empty()' failed.
8  swift           0x000000000111d436 swift::GenericSignature::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const + 566
9  swift           0x0000000000f5a0d0 swift::createDesignatedInitOverride(swift::TypeChecker&, swift::ClassDecl*, swift::ConstructorDecl*, swift::DesignatedInitKind) + 384
10 swift           0x0000000000edcd44 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 3284
11 swift           0x0000000000ecfcfe swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5998
12 swift           0x0000000000ed1077 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 375
17 swift           0x0000000001121464 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1188
18 swift           0x0000000000f16652 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 290
19 swift           0x0000000000ebc96a swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 4058
21 swift           0x000000000109a22b swift::Expr::walk(swift::ASTWalker&) + 27
22 swift           0x0000000000ebd1f0 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           0x0000000000ec443d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
24 swift           0x0000000000ec55f0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
25 swift           0x0000000000ec580b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
30 swift           0x0000000000ed7466 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000f3f67a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
34 swift           0x0000000000f3f4de swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
35 swift           0x0000000000f400a3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
37 swift           0x0000000000efb4a1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
38 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
40 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
41 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28403-swift-genericsignature-getsubstitutionmap.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28403-swift-genericsignature-getsubstitutionmap-72dd2a.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28403-swift-genericsignature-getsubstitutionmap.swift:14:22
2.	While type-checking 'b' at validation-test/compiler_crashers/28403-swift-genericsignature-getsubstitutionmap.swift:15:1
3.	While type-checking expression at [validation-test/compiler_crashers/28403-swift-genericsignature-getsubstitutionmap.swift:16:7 - line:16:7] RangeText="F"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-25 10:17:20 +02:00
Greg Parker
1c58cc20ba [stdlib] Remove workaround for an old clang bug (rdar://18950072). 2016-08-24 20:14:03 -07:00
Jordan Rose
258a0ade12 [APINotes] Protocols cannot use import-as-member. (#4482)
We could support this in the future but right now it's causing problems.
There's also a potential ambiguity issue here where a protocol and class
could have the same name.

In addition to updating the importer, remove the two entries from the
CryptoTokenKit API notes that were trying to use this feature.

rdar://problem/27990168
2016-08-24 16:02:28 -07:00
Doug Gregor
57f1090a11 Revert "[Set/Dictionary] Eliminate "bridging" collection entrypoints."
This reverts commit dc0ae675bc. The
change here (presumably the change to Foundation) caused a regression
in several of the bridging-related benchmarks, e.g.,
ObjectiveCBridgeFromNSSetAnyObjectToString, DictionaryBridge,
ObjectiveCBridgeFromNSDictionaryAnyObjectToString.
2016-08-24 13:20:03 -07:00
practicalswift
7a02db4ed6 [swiftc (55 vs. 5156)] Add crasher in swift::TypeBase::getCanonicalType(...)
Add test case for crash triggered in `swift::TypeBase::getCanonicalType(...)`.

Current number of unresolved compiler crashers: 55 (5156 resolved)

Assertion failure in [`include/swift/AST/Type.h (line 241)`](https://github.com/apple/swift/blob/master/include/swift/AST/Type.h#L241):

```
Assertion `isActuallyCanonicalOrNull() && "Forming a CanType out of a non-canonical type!"' failed.

When executing: swift::CanType::CanType(swift::TypeBase *)
```

Assertion context:

```
  static CanType getLValueOrInOutObjectTypeImpl(CanType type);
  static ClassDecl *getClassBoundImpl(CanType type);

public:
  explicit CanType(TypeBase *P = 0) : Type(P) {
    assert(isActuallyCanonicalOrNull() &&
           "Forming a CanType out of a non-canonical type!");
  }
  explicit CanType(Type T) : Type(T) {
    assert(isActuallyCanonicalOrNull() &&
           "Forming a CanType out of a non-canonical type!");
```
Stack trace:

```
swift: /path/to/swift/include/swift/AST/Type.h:241: swift::CanType::CanType(swift::TypeBase *): Assertion `isActuallyCanonicalOrNull() && "Forming a CanType out of a non-canonical type!"' failed.
8  swift           0x00000000011536e2 swift::TypeBase::getCanonicalType() + 2370
14 swift           0x000000000109a2de swift::Stmt::walk(swift::ASTWalker&) + 78
15 swift           0x0000000000f03b35 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) + 549
19 swift           0x000000000109a2de swift::Stmt::walk(swift::ASTWalker&) + 78
20 swift           0x0000000000f03b35 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) + 549
22 swift           0x0000000000efb4a1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
23 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
25 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
26 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28402-swift-typebase-getcanonicaltype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28402-swift-typebase-getcanonicaltype-e8cf35.o
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-24 11:32:11 +02:00
Arsen Gasparyan
20aa8cbfc7 Add tests for SetAlgebra protocol 2016-08-24 10:46:18 +03:00
practicalswift
424602a2cb [swiftc (54 vs. 5156)] Add crasher in ?
Add test case for crash triggered in `?`.

Current number of unresolved compiler crashers: 54 (5156 resolved)

Stack trace:

```
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-24 09:19:33 +02:00
swift-ci
db54d37936 Merge pull request #4472 from rudkx/crashers 2016-08-23 23:37:10 -07:00
swift-ci
05e0cb65fe Merge pull request #4471 from rudkx/remove-assert 2016-08-23 23:35:05 -07:00
Mark Lacey
dc7d433a40 Remove an overzealous assert.
When we are able to type check an expression this assert is fine,
although of little value. In the context of failed type checks, though,
it can be actively harmful.

The issue is that we can attempt to solve smaller parts of the
constraint system and assign contextual types (e.g. for the arguments of
a function) despite not being able to drill into members.

Some of the diagnostics we emit in these cases are not terribly useful,
and I've opened rdar://problem/27982012 with one example.

Resolves:
  rdar://problem/25812474
  rdar://problem/26589865
  rdar://problem/27974638
2016-08-23 21:58:29 -07:00
Slava Pestov
1705caaf72 Merge pull request #4038 from karwa/generic-enums
Fix SR-2134: emit 'rawValue' bodies for enums with a generic raw value
2016-08-23 21:52:50 -07:00
Mark Lacey
5d89924307 Add known type checker crashers.
Add minimized tests for:
    rdar://problem/27879334
2016-08-23 20:34:56 -07:00
Robert Widmann
ea1cb62b46 Merge pull request #4456 from practicalswift/swiftc-28400-swift-nominaltypedecl-prepareextensions
[swiftc (53 vs. 5156)] Add crasher in swift::constraints::ConstraintSystem::assignFixedType(...)
2016-08-23 14:24:13 -07:00
Ben Langmuir
2855634999 [codecomplete] Check for ErrorType before asking for CD->getResultType()
Fixes a crash where we try to cast ErrorType to a function type to get
the result.

rdar://problem/27763826
2016-08-23 13:14:56 -07:00
practicalswift
10c4204ef0 [swiftc (53 vs. 5156)] Add crasher in swift::constraints::ConstraintSystem::assignFixedType(...)
Add test case for crash triggered in `swift::constraints::ConstraintSystem::assignFixedType(...)`.

Current number of unresolved compiler crashers: 53 (5156 resolved)

Assertion failure in [`lib/Sema/ConstraintGraph.cpp (line 207)`](https://github.com/apple/swift/blob/master/lib/Sema/ConstraintGraph.cpp#L207):

```
Assertion `!adjacency.FixedBinding && "Already marked as a fixed binding?"' failed.

When executing: void swift::constraints::ConstraintGraphNode::addFixedBinding(swift::TypeVariableType *)
```

Assertion context:

```
}

void ConstraintGraphNode::addFixedBinding(TypeVariableType *typeVar) {
  auto &adjacency = getAdjacency(typeVar);

  assert(!adjacency.FixedBinding && "Already marked as a fixed binding?");
  adjacency.FixedBinding = true;
}

void ConstraintGraphNode::removeFixedBinding(TypeVariableType *typeVar) {
  modifyAdjacency(typeVar, [](Adjacency &adj) {
```
Stack trace:

```
swift: /path/to/swift/lib/Sema/ConstraintGraph.cpp:207: void swift::constraints::ConstraintGraphNode::addFixedBinding(swift::TypeVariableType *): Assertion `!adjacency.FixedBinding && "Already marked as a fixed binding?"' failed.
9  swift           0x0000000000f61c3e swift::constraints::ConstraintSystem::assignFixedType(swift::TypeVariableType*, swift::Type, bool) + 366
10 swift           0x0000000000fc8f9e swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 3262
11 swift           0x0000000000fcd27d swift::constraints::ConstraintSystem::matchDeepEqualityTypes(swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder) + 877
12 swift           0x0000000000fcdc15 swift::constraints::ConstraintSystem::simplifyRestrictedConstraint(swift::constraints::ConversionRestrictionKind, swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 1077
13 swift           0x0000000000fd5097 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 439
14 swift           0x0000000000fddc0d swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11277
15 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
16 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
17 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
18 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
19 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
20 swift           0x0000000000fdf3c1 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 17345
21 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
22 swift           0x0000000000fdf3c1 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 17345
23 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
24 swift           0x0000000000fdf3c1 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 17345
25 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
26 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
27 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
28 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
29 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
30 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
31 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
32 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
33 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
34 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
35 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
36 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
37 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
38 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
39 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
40 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
41 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
42 swift           0x0000000000fd9779 swift::constraints::ConstraintSystem::solve(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 73
43 swift           0x0000000000ebd438 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>) + 808
44 swift           0x0000000000ec443d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
45 swift           0x0000000000ec55f0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
46 swift           0x0000000000ec580b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
49 swift           0x0000000000ed7466 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
51 swift           0x0000000000f40ae6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
52 swift           0x0000000000efb40d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
53 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
55 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
56 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28400-swift-nominaltypedecl-prepareextensions.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28400-swift-nominaltypedecl-prepareextensions-72c649.o
1.	While type-checking declaration 0x6578c80 at validation-test/compiler_crashers/28400-swift-nominaltypedecl-prepareextensions.swift:15:1
2.	While type-checking expression at [validation-test/compiler_crashers/28400-swift-nominaltypedecl-prepareextensions.swift:15:9 - line:15:28] RangeText="s1 ?? s2 ?? s3 ?? []"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-23 09:29:13 +02:00
Robert Widmann
fa36206531 Merge pull request #4449 from practicalswift/swiftc-28399-getpointerelementtype-is-not-storagetype
[swiftc (52 vs. 5156)] Add crasher in swift::irgen::emitPolymorphicParameters(...)
2016-08-22 22:40:59 -07:00
Doug Gregor
dc0ae675bc [Set/Dictionary] Eliminate "bridging" collection entrypoints.
Remove the functions
_(set|dictionary)Bridge(From|To)ObjectiveC(Conditional) from the
standard library. These entrypoints are no longer used by the compiler
(thanks to generalized collection up/downcasting), so stop using them
in Foundation and in tests.
2016-08-22 15:14:09 -07:00
SpringsUp
f9af1257ef Tighter type-checking of enums with synthesized RawRepresentable
conformance
Fixes SR-2134
2016-08-22 22:49:48 +02:00
practicalswift
7059140029 [swiftc (52 vs. 5156)] Add crasher in swift::irgen::emitPolymorphicParameters(...)
Add test case for crash triggered in `swift::irgen::emitPolymorphicParameters(...)`.

Current number of unresolved compiler crashers: 52 (5156 resolved)

Assertion failure in [`lib/IRGen/GenProto.cpp (line 1810)`](https://github.com/apple/swift/blob/master/lib/IRGen/GenProto.cpp#L1810):

```
Assertion `targetDepType->isTypeParameter()' failed.

When executing: void addPotentialArchetypeAccessPath(swift::irgen::IRGenFunction &, swift::CanType, swift::CanType, GetTypeParameterInContextFn)
```

Assertion context:

```
  case SILFunctionTypeRepresentation::Thick:
  case SILFunctionTypeRepresentation::Thin:
  case SILFunctionTypeRepresentation::Method:
    return ty->isPolymorphic();

  case SILFunctionTypeRepresentation::CFunctionPointer:
  case SILFunctionTypeRepresentation::ObjCMethod:
    // May be polymorphic at the SIL level, but no type metadata is actually
    // passed.
    return false;

```
Stack trace:

```
swift: /path/to/swift/lib/IRGen/GenProto.cpp:1810: void addPotentialArchetypeAccessPath(swift::irgen::IRGenFunction &, swift::CanType, swift::CanType, GetTypeParameterInContextFn): Assertion `targetDepType->isTypeParameter()' failed.
10 swift           0x000000000087bd49 swift::irgen::emitPolymorphicParameters(swift::irgen::IRGenFunction&, swift::SILFunction&, swift::irgen::Explosion&, swift::irgen::WitnessMetadata*, llvm::function_ref<llvm::Value* (unsigned int)> const&) + 1033
12 swift           0x00000000008b35d4 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 1268
13 swift           0x0000000000810c95 swift::irgen::IRGenerator::emitGlobalTopLevel() + 405
15 swift           0x00000000007ea0a4 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 68
17 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
18 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28399-getpointerelementtype-is-not-storagetype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28399-getpointerelementtype-is-not-storagetype-cd8726.o
1.	While emitting IR SIL function @_TTWV4main1HS_1ES_FS1_1guRd__S_1Awx1Fzwd__1BrfGVS_1Cqd___T_ for 'g' at validation-test/compiler_crashers/28399-getpointerelementtype-is-not-storagetype.swift:19:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-22 12:27:14 +02:00
Paulo Faria
1ed756ec84 Add sendfile to Glibc 2016-08-21 17:43:20 -07:00
Greg Parker
f50b1e73dc Revert "Make all CF types Equatable and Hashable." 2016-08-20 04:33:55 -07:00
Jordan Rose
361ab62454 Make all CF types Equatable and Hashable. (#4394)
Like NSObject, CFType has primitive operations CFEqual and CFHash,
so Swift should allow those types to show up in Hashable positions
(like dictionaries). The most general way to do this was to
introduce a new protocol, _CFObject, and then have the importer
automatically make all CF types conform to it.

This did require one additional change: the == implementation that
calls through to CFEqual is in a new CoreFoundation overlay, but the
conformance is in the underlying Clang module. Therefore, operator
lookup for conformances has been changed to look in the overlay for
an imported declaration (if there is one).

https://bugs.swift.org/browse/SR-2388
2016-08-19 13:21:24 -07:00
practicalswift
2548cbb78f [swiftc (51 vs. 5156)] Add crasher in swift::ArchetypeBuilder::getGenericSignature(...)
Add test case for crash triggered in `swift::ArchetypeBuilder::getGenericSignature(...)`.

Current number of unresolved compiler crashers: 51 (5156 resolved)

Assertion failure in [`lib/AST/ArchetypeBuilder.cpp (line 2249)`](https://github.com/apple/swift/blob/master/lib/AST/ArchetypeBuilder.cpp#L2249):

```
Assertion `pa && "Missing potential archetype for generic parameter"' failed.

When executing: void collectRequirements(swift::ArchetypeBuilder &, ArrayRef<swift::GenericTypeParamType *>, SmallVectorImpl<swift::Requirement> &)
```

Assertion context:

```
  // of the requirements.
  llvm::SmallPtrSet<PotentialArchetype *, 16> knownPAs;
  llvm::SmallVector<GenericTypeParamType *, 8> primary;
  for (auto param : params) {
    auto pa = builder.resolveArchetype(param);
    assert(pa && "Missing potential archetype for generic parameter");

    // We only care about the representative.
    pa = pa->getRepresentative();

    if (knownPAs.insert(pa).second)
```
Stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2249: void collectRequirements(swift::ArchetypeBuilder &, ArrayRef<swift::GenericTypeParamType *>, SmallVectorImpl<swift::Requirement> &): Assertion `pa && "Missing potential archetype for generic parameter"' failed.
8  swift           0x000000000101fae4 swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>) + 1604
9  swift           0x0000000000f11128 swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 296
12 swift           0x0000000000ed12b1 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 945
15 swift           0x000000000113a4e2 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           0x0000000001141b3f swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 4703
17 swift           0x0000000000f1516b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
18 swift           0x0000000000ebba04 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 116
21 swift           0x000000000109a25b swift::Expr::walk(swift::ASTWalker&) + 75
22 swift           0x0000000000ebd1f0 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           0x0000000000ec443d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
24 swift           0x0000000000ec55f0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
25 swift           0x0000000000ec580b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
32 swift           0x0000000000ed7466 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000efb3a2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
34 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
36 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
37 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28398-swift-archetypebuilder-getgenericsignature.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28398-swift-archetypebuilder-getgenericsignature-207c59.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28398-swift-archetypebuilder-getgenericsignature.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28398-swift-archetypebuilder-getgenericsignature.swift:10:26 - line:10:27] RangeText="c<"
3.	While type-checking '<' at validation-test/compiler_crashers/28398-swift-archetypebuilder-getgenericsignature.swift:10:50
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-19 09:12:15 +02:00
Robert Widmann
9f06cac8fa Merge pull request #4370 from practicalswift/swiftc-28397-getselftypeforcontainer
[swiftc (50 vs. 5156)] Add crasher in ?
2016-08-18 19:11:09 -07:00
Jordan Rose
ba3de9ee3b NSNumber already preserves whether a value was originally boolean. (#4366)
Use that instead of rolling it up in _SwiftTypePreservingNSNumber so that we
get the right behavior when we go to write plists.

https://bugs.swift.org/browse/SR-2381
2016-08-18 15:45:30 -07:00
Doug Gregor
27515b623e Revert "NSNumber bridging: use BOOL rather than _Bool when bridging Bools." 2016-08-18 10:36:43 -07:00
Doug Gregor
3b64ac6970 Merge pull request #4363 from DougGregor/nsnumber-bool-bridging
NSNumber bridging: use BOOL rather than _Bool when bridging Bools.
2016-08-18 10:20:13 -07:00
practicalswift
dfb357c6c4 [swiftc (50 vs. 5156)] Add crasher in ?
Add test case for crash triggered in `?`.

Current number of unresolved compiler crashers: 50 (5156 resolved)

Stack trace:

```
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-18 09:38:30 +02:00
Doug Gregor
d68e59371a NSNumber bridging: use BOOL rather than _Bool when bridging Bools.
The Objective-C type encoding of Boolean values in NSNumber is that of
BOOL, which is either signed char or _Bool depending on the
platform. _SwiftTypePreservingNSNumber was using _Bool, which led to
inconsistencies when bridging vs. creating an NSNumber directly. Use
BOOL consistently.

Fixes rdar://problem/27894308.
2016-08-17 16:49:30 -07:00
Dave Abrahams
dc777eec78 [stdlib] Deprecate ExpressibleByStringInterpolation
We know its API is
inadequate (https://bugs.swift.org/browse/SR-1260?jql=text%20~%20%22StringInterpolationConvertible%22)
and don't want to be constrained to supporting it in future versions.
2016-08-17 13:45:06 -07:00
Doug Gregor
65d8f03448 Merge pull request #4329 from rjmccall/collection-upcast-oves
Fix this to not die on the OVEs from collection upcasts.
2016-08-17 10:40:56 -07:00
swift-ci
ebb25cc8fa Merge pull request #4346 from CodaFi/post-fix-the-prefix-postfix-prefixed-patch 2016-08-17 00:50:12 -07:00
Robert Widmann
740721ab2f Address Dmitri's comments on #3600 2016-08-16 23:59:00 -07:00
Dmitri Gribenko
fc001e9a85 Merge pull request #4316 from practicalswift/swiftc-28396-swift-lowering-silgenfunction-emitclosurevalue
[swiftc (49 vs. 5156)] Add crasher in swift::SILModule::constructSIL(...)
2016-08-17 09:19:47 +03:00
John McCall
e360d7f2b0 Fix the open-existential remover to not die on the OVEs in collection upcasts. 2016-08-16 22:17:02 -07:00
Mark Lacey
be5636ad8d Merge pull request #4341 from rudkx/crashers
Add known type checker crashers.
2016-08-16 20:32:50 -07:00