Commit Graph

481 Commits

Author SHA1 Message Date
Slava Pestov
8bfe205c52 AST: Make TypeBase::getSuperclass() return the superclass type when called on an UnboundGenericType
Fixes <https://bugs.swift.org/browse/SR-3137>.
2017-01-03 20:15:30 -08:00
Slava Pestov
5f9fe6fa2c SILGen: Fix crash with non-scalar casts requiring re-abstraction
This might only come up in invalid code, but for example
casting a function type to String would trigger it.
2017-01-03 19:05:41 -08:00
Slava Pestov
4daf56b648 SILGen: Fix calls to literal constructors defined in protocol extensions
Fixes <https://bugs.swift.org/browse/SR-3173>.
2017-01-03 19:05:41 -08:00
Slava Pestov
ad01c1e929 SILGen: Implement missing function conversions from tuples to Any
Fixes <https://bugs.swift.org/browse/SR-3267> and
<rdar://problem/22465834>.
2017-01-03 19:05:40 -08:00
Robert Widmann
3a4eb3f8ac Validate an assumption in 'lookupConstructors'
Invalid ASTs like the one in 28625 cause Parse to generate an AST that
looks a heck of a lot like a constructor call, however this makes no
sense as the type in question is a TupleType and lookup asserts in such
cases.  Guard against this so we don't crash diagnosing.
2017-01-03 19:03:23 -07:00
practicalswift
a3ccac27db [gardening] Remove "REQUIRES: asserts" from fixed crashers. 2016-12-11 00:50:26 +01:00
Slava Pestov
e063e8297c Sema: Some fixes for the ITC
- In functions called from resolveType(), consistently
  use a Type() return value to indicate 'unsatisfied
  dependency', and ErrorType to indicate failure.

- Plumb the unsatisfiedDependency callback through the
  resolution of the arguments of BoundGenericTypes, and
  also pass down the options.

- Before doing a conformance check on the argument of a
  BoundGenericType, kick off a TypeCheckSuperclass request
  if the type in question is a class. This ensures we don't
  recurse through NominalTypeDecl::prepareConformanceTable(),
  which wants to see a class with a valid superclass.

- The ResolveTypeOfDecl request was assuming that
  the request was satisfied after calling validateDecl().
  This is not the case when the ITC is invoked from a
  recursive call to validateDecl(), hack this up by returning
  *true* from isResolveTypeDeclSatisfied(); otherwise we
  assert in satisfy(), and we can't make forward progress
  in this case anyway.

- Fix a bug in cycle breaking; it seems if we don't invoke
  the cycle break callback on all pending requests, we end
  up looping forever in an outer call to satisfy().

- Remove unused TR_GlobalTypeAlias option.
2016-12-09 17:36:49 -08:00
practicalswift
e8fad3a2a1 [gardening] Mark crash cases as fixed. 2016-12-09 21:46:43 +01:00
Pavel Yaskevich
d111e9b4be [Diagnostics] When building a subscript don't assume that overload is always present
This handles situation when overload for the subscript hasn't been resolved
by constraint solver, such might happen, for example, if solver was allowed to
produce solutions with free or unresolved type variables (e.g. when running diagnostics).

Resolves: <rdar://problem/27329076>, <rdar://problem/28619118>, <rdar://problem/2778734>.
2016-11-28 19:18:44 -08:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Dmitri Gribenko
987acd375d stdlib: make tests rely on Array implementation details less 2016-08-07 14:20:36 -07:00
Michael Ilseman
49e0685151 [noescape by default] drop superfluous @noescape from validation suite 2016-08-04 16:23:06 -07:00
Robert Widmann
e1ae0391e8 Fixup validation tests 2016-07-30 03:50:16 -07:00
Jordan Rose
6dea23a029 Flip the switch on 'private' and 'fileprivate' (SE-0025).
More tests to come soon. In particular, validation of members used in
protocol conformances is still not correct.
2016-07-28 09:55:23 -07:00
Dave Abrahams
dcbfdb5339 _ includeElement/whereElementsSatisfy predicate => _ isIncluded 2016-07-19 07:05:54 -06:00
Andrew Trick
73106dd7c3 Rename initialize(with:count:) to initialize(to:count:). (#3601)
As proposed in SE-0107: UnsafeRawPointer.

"with" is considered a vacuous preposition. "to" implies direction.
2016-07-18 23:37:45 -07:00
Michael Gottesman
fc37603c5f Revert "Implement SE-0118" 2016-07-18 16:44:58 -07:00
Dave Abrahams
4bb21b8a2f _ includeElement/whereElementsSatisfy predicate => _ isIncluded 2016-07-18 14:29:09 -06:00
Michael Gottesman
a047bb7564 Revert "Fix the build."
This reverts commit dc24c2bd34.

Turns out Chris fixed the build but when I was looking at the bots, his fix had
not been tested yet, so I thought the tree was still red and was trying to
revert to green.
2016-07-17 16:29:18 -07:00
Michael Gottesman
dc24c2bd34 Fix the build.
This reverts commit b4cba58330.
This reverts commit a602927c75.
This reverts commit 55fbe5a763.
2016-07-17 16:17:15 -07:00
Chris Lattner
b4cba58330 With the removal of Boolean, this test is now valid. 2016-07-17 15:49:54 -07:00
Michael Gottesman
40e1991e12 Revert "Name and label changes for closure parameters (for review only) (#2981)"
This reverts commit 18406900ba.
2016-07-15 19:45:26 -07:00
Dave Abrahams
18406900ba Name and label changes for closure parameters (for review only) (#2981)
Implement SE-0118 Name and label changes for closure parameters

[SE-0118](https://github.com/apple/swift-evolution/blob/master/proposals/0118-closure-parameter-names-and-labels.md)
2016-07-15 15:31:48 -07:00
practicalswift
4f89520c93 Case #08008 belongs to "compiler_crashers" (and not "compiler_crashers_2") :-) 2016-07-12 02:04:53 +02:00
Chris Lattner
87db7b4cf2 update validation tests to modern syntax. 2016-07-02 17:10:49 -07:00
Dmitri Gribenko
fc8d62dfbb Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-18 14:40:06 -07:00
Chris Lattner
3aa4ff4332 fix a validation test that was using ++/-- 2016-04-17 09:15:07 -07:00
Dmitri Gribenko
cfea1a3f58 Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-14 17:00:46 -07:00
Dmitri Gribenko
10697f939f Merge commit '510f29abf77e202780c11d5f6c7449313c819030' into swift-3-indexing-model 2016-04-14 13:45:27 -07:00
Manav Gabhawala
8f4f37f072 [Sema] Fixes infinite recursion when inheriting from a member of the same type 2016-04-13 18:18:09 -04:00
Dmitri Gribenko
f8f75a2b95 Make a crash test more self-contained 2016-04-08 20:27:55 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Doug Gregor
cbdc7bc5e0 [Archetype builder] Typealiases can be found in protocol extensions, too.
Don't crash when we find them; narrow fix for rdar://problem/25298116.
2016-04-01 12:58:11 -07:00
Dmitri Gribenko
7b03d9c499 Add a test for rdar://21775089, which is fixed now
We used to go into infinite recursion in IRGen:

    frame #21776: 0x00000001000bf49b swift`llvm::Value* swift::CanTypeVisitor<(anonymous namespace)::EmitTypeMetadataRef, llvm::Value*>::visit<>(swift::CanType) + 331
    frame #21777: 0x00000001000b3177 swift`swift::irgen::IRGenFunction::emitTypeMetadataRef(swift::CanType) + 87
    frame #21778: 0x00000001000c0ed3 swift`emitNominalMetadataRef(swift::irgen::IRGenFunction&, swift::NominalTypeDecl*, swift::CanType) + 771
    frame #21779: 0x00000001000bf49b swift`llvm::Value* swift::CanTypeVisitor<(anonymous namespace)::EmitTypeMetadataRef, llvm::Value*>::visit<>(swift::CanType) + 331
    frame #21780: 0x00000001000b3177 swift`swift::irgen::IRGenFunction::emitTypeMetadataRef(swift::CanType) + 87
    frame #21781: 0x00000001000c0ed3 swift`emitNominalMetadataRef(swift::irgen::IRGenFunction&, swift::NominalTypeDecl*, swift::CanType) + 771
    frame #21782: 0x00000001000bf49b swift`llvm::Value* swift::CanTypeVisitor<(anonymous namespace)::EmitTypeMetadataRef, llvm::Value*>::visit<>(swift::CanType) + 331
    frame #21783: 0x00000001000b3177 swift`swift::irgen::IRGenFunction::emitTypeMetadataRef(swift::CanType) + 87
    frame #21784: 0x00000001000c0ed3 swift`emitNominalMetadataRef(swift::irgen::IRGenFunction&, swift::NominalTypeDecl*, swift::CanType) + 771
    frame #21785: 0x00000001000bf49b swift`llvm::Value* swift::CanTypeVisitor<(anonymous namespace)::EmitTypeMetadataRef, llvm::Value*>::visit<>(swift::CanType) + 331
    frame #21786: 0x00000001000b3177 swift`swift::irgen::IRGenFunction::emitTypeMetadataRef(swift::CanType) + 87
    frame #21787: 0x00000001000f5d3f swift`swift::irgen::emitPolymorphicArguments(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::Substitution>, swift::irgen::WitnessMetadata*, swift::irgen::Explosion&) + 847
    frame #21788: 0x0000000100155f9e swift`(anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 1374
    frame #21789: 0x0000000100142211 swift`(anonymous namespace)::IRGenSILFunction::emitSILFunction() + 11889
    frame #21790: 0x000000010013f025 swift`swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 725
    frame #21791: 0x000000010008a67c swift`swift::irgen::IRGenModuleDispatcher::emitGlobalTopLevel() + 412
    frame #21792: 0x00000001001257b7 swift`performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 855
    frame #21793: 0x0000000100125d16 swift`swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 70
    frame #21794: 0x000000010000d116 swift`performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 12070
    frame #21795: 0x0000000100009fce swift`frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2638
    frame #21796: 0x00000001000061d3 swift`main + 2131
    frame #21797: 0x00007fff9a29e5ad libdyld.dylib`start + 1
    frame #21798: 0x00007fff9a29e5ad libdyld.dylib`start + 1
(lldb) ^D
2016-03-30 13:41:35 -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
gregomni
78216b2990 Change all remaining tests that use typealias in a protocol to use associatedtype. 2016-03-09 18:08:52 -08:00
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Chris Lattner
0a8db5daf6 Fix <rdar://problem/23899799> Simple closure expression crashed SourceKit
which is a straight-forward logic bug that the static analyzer would have caught.
2016-02-27 22:41:00 -08:00
Xi Ge
b109145dfc [TypeChecker] Add null check to fix a crash. 2016-02-27 21:38:55 -08:00
Daniel Duan
2bc78b8c09 [stdlib] update for 'inout' adjustment (SE-0031) 2016-02-26 12:02:29 -08:00
Jordan Rose
0205191e32 stdlib: SequenceType._initializeTo(_:) becomes _copyContents(initializing:) 2016-02-23 16:58:49 -08:00
Dave Abrahams
ece87787e0 stdlib: merge swift 3 UnsafePointer migrations 2016-02-23 15:45:45 -08:00
Dave Abrahams
d96b051d28 stdlib: initializePointee(_) => initialize(with:)
Tacking "Pointee" on just for unary operations (and especially
operations with an optional count) created inconsistency.
2016-02-23 15:15:23 -08:00
Dmitri Gribenko
f0633ce5a9 stdlib: Sequence.iterator() => .makeIterator() 2016-02-23 13:52:30 -08:00
Max Moiseev
78ba5d5f3f [stdlib] Requires in comments changed to Precondition 2016-02-19 18:57:26 -08:00
Dmitri Gribenko
b90470e2fe Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-19 09:51:53 -08:00
Dmitri Gribenko
a73390c06d stdlib tests: replace '__FILE__' and '__LINE__' with '#file' and '#line' 2016-02-18 18:48:29 -08:00
Dmitri Gribenko
efaa39ea79 stdlib: add first argument labels and some other changes to conform to API guidelines 2016-02-15 23:47:54 -08:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00