Commit Graph

151 Commits

Author SHA1 Message Date
Slava Pestov
129024e634 Add regression test for a bug that got fixed along the way 2017-02-12 00:51:25 -08:00
Slava Pestov
6874b89550 Add regression test for a bug that seems to be fixed 2017-02-08 15:45:27 -08:00
Slava Pestov
f166bb3295 Fix numbering compiler_crashers_2_fixed test cases 2017-02-08 15:43:08 -08:00
swift-ci
fabac930e9 Merge pull request #7304 from DougGregor/sr-3857 2017-02-07 10:03:42 -08:00
Doug Gregor
87b25ef4d3 Add test for fixed crasher in SR-3857 / rdar://problem/30361930.
Recent improvements fixed this crasher that manifested in
IRGen.
2017-02-07 06:21:48 -08:00
Jordan Rose
898940c2dd Extensions of imported classes never provide overriding initializers. (#7284)
This addresses a crash where the compiler asks if an imported class
inherits initializers from its superclass /during the SIL passes/. In
this particular arrangement of subclasses and initializers (see test
case), this leads to us importing members of an Objective-C class for
the first time well after we've destroyed the type checker, and then
checking to see if an initializer added in a Swift extension can
prevent initializer inheritance. That initializer hasn't been
type-checked (because it's in another file and isn't supposed to
affect anything), and so the compiler chokes. A spot fix would merely
check for 'resolver' here and skip over the initializer if it doesn't
have a type, but it's not clear what the right semantics are in that
case.

The real issue here is that we don't support importing new declarations
after the type checker has been torn down, and that keeps causing us
problems, but that's a much bigger thing to fix.

https://bugs.swift.org/browse/SR-3853
2017-02-06 16:26:13 -08:00
Rintaro Ishizaki
abeaaeb42f [Parse] Fix potential crasher regarding EndLoc of erroneous 'type(of:)' expr 2017-02-02 17:13:14 +09:00
Slava Pestov
f9789ce5a8 AST: Fix compareDependentTypes() for protocol typealiases
We must order protocol typealiases *after* other types, so that
if a protocol typealias is equal to an associated type, the
representative is chosen to be the associated type and not the
typealias.

Fixes <https://bugs.swift.org/browse/SR-3687> and
<rdar://problem/30118513>.
2017-01-26 21:33:25 -08:00
Jordan Rose
25e40d0a57 Use interface types when checking #keyPath. (#7028)
This avoids a crash when the path refers to a property in another
Swift module.

https://bugs.swift.org/browse/SR-3714
2017-01-25 19:29:42 -08:00
Slava Pestov
8ad5504fe0 SILGen: Relax assertion in tuple-to-optional function result conversion
Now that optional payloads can be re-abstracted, there's a case
where we need to do a tuple-to-tuple conversion on a direct result;
if the result is wrapped in an Optional. So I believe this assert
is not right.

Fixes <https://bugs.swift.org/browse/SR-3706>.
2017-01-24 18:47:21 -08:00
Slava Pestov
8109cf7187 Add regression test for a bug that's already been fixed 2017-01-23 23:54:50 -08:00
practicalswift
8c2b87bce0 [gardening] Add correct copyright notices 2017-01-07 20:32:18 +01:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Slava Pestov
51d4869473 Add a regression test for <https://github.com/apple/swift/pull/6536>
The PR added a Sema test with a minimal test case; add a bigger test
more closely resembling the original snippet and make sure it gets
all the way through IRGen.
2017-01-05 18:00:45 -08:00
Slava Pestov
58228d3a6e Add regression test for a radar that got fixed along the way 2017-01-05 18:00:39 -08:00
Slava Pestov
3cbc08cc4e AST/SIL: Fix problems if protocol requirement signature makes Self : P conformance implicit
Fixes assertion failures in SILGen and the optimizer with this
exotic setup:

protocol P {
  associatedtype T : Q
}

protocol Q {
  func requirement<U : P>(u: U) where U.T == Self
}

Here, we only have a U : P conformance, and not Self : Q,
because Self : Q is available as U.T : Q.

There were three problems here:

- The SIL verifier was too strict in verifying the generic signature.
  All that matters is we can get the Self parameter conformance, not
  that it's the first requirement, etc.

- GenericSignature::getSubstitutionMap() had a TODO concerning handling
  of same-type constraints -- this is the first test-case I've found
  that triggered the problem.

- GenericEnvironment::getSubstitutionMap() incorrectly ignored
  same-type constraints where one of the two types was a generic
  parameter.

Fixes <https://bugs.swift.org/browse/SR-3321>.
2017-01-04 02:28:55 -08:00
Slava Pestov
412559af79 Add test cases for a few bugs that seem to be fixed already
Cleaning out some old JIRAs, don't want these to regress...
2017-01-04 02:02:29 -08:00
Slava Pestov
16820526b8 This test requires Objective-C interop 2017-01-03 22:22:14 -08:00
Slava Pestov
9b03f9d18c SILGen: Fix reabstraction thunk emission when generic parameters are made non-canonical
In a generic signature like <T, U where T.A == U>, there is only
one primary archetype, 'T'. 'U' will not appear in SubstitutionMaps,
and the SubstitutionMap version of Type::subst() cannot handle an
interface type containing 'U'.

For interface types, there are two levels of canonicalization:

- The AST-level getCanonicalType() which strips away sugar

- The GenericSignature-level getCanonicalTypeInContext() which
  replaces each interface type in an equivalence class with a
  representative

SILFunctionTypes must be canonical with respect to a generic
signature.

When emitting re-abstraction thunks we could end up constructing
a SILFunctionType containing 'U', because we were calling
getCanonicalType() on the result of mapTypeOutOfContext().

Fix this by making sure to use getCanonicalTypeInContext() on
the result of mapTypeOutOfContext(), just as we do in capture
lowering.

Unfortunately I worry this problem will come up again in a
different form -- a more general fix would change
mapTypeOutOfContext() to always return "generic signature
canonical" types, and also fix SubstitutionMaps to understand
same type constraints better.

Fixes <https://bugs.swift.org/browse/SR-3326>.
2017-01-03 21:49:44 -08:00
Slava Pestov
645d262f77 IRGen: Fix Clang type conversion for pointers to optionals of metatypes
Be sure to lower the payload type of UnsafeMutablePointer and friends
before converting them, because the Clang type converter expects
optionals to have lowered payloads already.

Also, remove the FunctionType path; with the above change AST-level
function types should no longer show up here.

Fixes <https://bugs.swift.org/browse/SR-2702>.
2017-01-03 21:27:28 -08:00
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