Commit Graph

7628 Commits

Author SHA1 Message Date
Joe Groff
bdacc06d86 Check off crasher #025.
Swift SVN r22203
2014-09-23 03:28:50 +00:00
Dave Abrahams
a9897a1aa1 [stdlib] Don't test internal APIs in validation
Swift SVN r22190
2014-09-22 22:24:07 +00:00
Joe Groff
4a938f35c7 Add validation test for case in rdar://problem/17963339.
Swift SVN r22141
2014-09-19 19:08:51 +00:00
Doug Gregor
7764f64cf8 Simplify assertion machinery in the standard library.
This change includes a number of simplifications that allow us to
eliminate the type checker hack that specifically tries
AssertString. Doing so provides a 25% speedup in the
test/stdlib/ArrayNew.swift test (which is type-checker bound).

The specific simplifications here:
  - User-level
  assert/precondition/preconditionalFailure/assertionFailer/fatalError
  always take an autoclosure producing a String, eliminating the need
  for the StaticString/AssertString dance.
  - Standard-library internal _precondition/_sanityCheck/etc. always
  take a StaticString. When we want to improve the diagnostics in the
  standard library, we can provide a separate overload or
  differently-named function.
  - Remove AssertString, AssertStringType, StaticStringType, which are
  no longer used or needed
  - Remove the AssertString hack from the compiler
  - Remove the "BooleanType" overloads of these functions, because
  their usefuless left when we stopped making optional types conform
  to BooleanType (sorry, should have been a separate patch).



Swift SVN r22139
2014-09-19 17:56:50 +00:00
Joe Pamer
a474d86305 When checking for shadowed values, account for the fact that we may be checking the rhs of a recursive binding.
This addresses crash suite scenarios 016 and 034. (rdar://problem/17837823)

Swift SVN r22125
2014-09-19 06:12:32 +00:00
Joe Groff
da26c54c06 IRGen: Preserve associated types and witness tables in NecessaryBindings.
Fixes crasher #003 (rdar://problem/18232605). This time, also increase the buffer size for the necessary bindings so we don't clobber memory.

Swift SVN r22118
2014-09-19 04:00:58 +00:00
Joe Pamer
f9db2f0c9d When checking conformances, if we fail to find a witness for one associated type member refrain from attempting to resolve the others.
(If any other associated type member has a dependency on the invalid one, we won't be able to substitute and the compiler will crash.)

This addresses crash suite scenario 035. (rdar://problem/18233020)

Swift SVN r22116
2014-09-19 03:25:35 +00:00
Joe Pamer
ffc37729c8 Revert "IRGen: Preserve associated types and witness tables in NecessaryBindings."
This reverts commit r22108

Swift SVN r22115
2014-09-19 02:49:17 +00:00
Joe Pamer
783a8c6247 Prohibit type declarations within generic functions, which were causing the compiler to crash.
You'll notice that we already had tests that made it appear that such declarations could work,
but they were only avoiding crashes because downstream errors were already marking the
enclosing functions as invalid. (If the errors were fixed, they would also crash the compiler.)

This addresses crash suite scenario 018. (rdar://problem/18299547)

Swift SVN r22109
2014-09-19 00:18:43 +00:00
Joe Groff
b0dea1625f IRGen: Preserve associated types and witness tables in NecessaryBindings.
Fixes crasher #003 (rdar://problem/18232605).

Swift SVN r22108
2014-09-19 00:06:18 +00:00
Joe Groff
bee33a060c Sema: Ban pattern bindings without variables in globals and properties.
There's no real use for declaring a property or global variable without binding it to anything, and closure context mangling relies on having a name to associate with closures. Fixes crash suite #006 (rdar://problem/18232699).

Swift SVN r22105
2014-09-18 22:59:58 +00:00
Joe Pamer
b2891be810 When performing module lookups, respect the resolution mode when deciding whether or not to validate any found declarations.
Doing so prevents another common source of stack overflows in the validator, and addresses crash suite scenarios 002 and 004.
(rdar://problem/18232499, rdar://problem/18232668)

Swift SVN r22104
2014-09-18 22:51:34 +00:00
Joe Pamer
1ea993c317 If the generic type parameters of a class or struct declaration are invalid or otherwise broken, we should treat the declaration as invalid, and be more careful about doing anything that could lead to the creation of bogus archetypes. (Such as implicit constructor/destructor generation, or conformance checking.)
This addresses crash suite scenario 022. (rdar://problem/18232772)

Swift SVN r22095
2014-09-18 20:10:02 +00:00
Joe Pamer
436e135d3d Prevent another stack overflow in the type checker by avoiding recursively validating generic parameter lists. (rdar://problem/18072109 and crash suite scenario 021.)
Swift SVN r22094
2014-09-18 20:10:00 +00:00
Doug Gregor
7f2757b5d0 Update validation suite to use initializers for literal conformances.
Swift SVN r22079
2014-09-18 16:48:47 +00:00
Dmitri Hrybenko
bda201fe95 Fix typo in the test name
Swift SVN r22068
2014-09-18 10:52:17 +00:00
Dmitri Hrybenko
2475a4ea57 stdlib: mark _stdlib_AtomicInt class 'final'
Swift SVN r22067
2014-09-18 09:31:52 +00:00
Joe Pamer
dd141c7cad Account for recursive validation when checking if an existential conforms to itself. (rdar://problem/18042380)
This can only occur when validating mutually recursive existentials in type reference expressions, so it's "safe" to avoid validating member value decls in this case. There are still potential holes in our mechanism for checking for unsupported existentials, but at least this will eliminate another common crasher. (Crash suite scenario 010.)

Swift SVN r22035
2014-09-17 20:23:41 +00:00
Dmitri Hrybenko
78331ff9fa Update HashingPrototype for stdlib API changes
Swift SVN r22021
2014-09-17 13:10:25 +00:00
Joe Groff
d3702950af SILGen: Materialize class-constrained "self" parameters when passed to non-class-constrained protocol methods.
Fixes rdar://problem/17480006, rdar://problem/17557409, rdar://problem/17929884 and crash suite #019.

Swift SVN r21981
2014-09-16 21:12:40 +00:00
Joe Groff
041c179e01 SIL: Continue type lowering after address-only fields of aggregates.
Now that we rely on type lowering to catch recursive value types, this optimization is no longer valid. Fixes rdar://problem/18232757 (crash suite #015).

Swift SVN r21967
2014-09-16 04:55:44 +00:00
Joe Groff
1c4e08a9c8 Fix up a tangle of issues related to reabstraction.
- A spot fix in SILGen for reabstracting the result of a downcast, which fixes checked casts to function types.
- Associate the layout information in type metadata records with the most abstract representation of the type. This is the correct thing to do in cases where we need the metadata as a tag for an opaque value--if we store a value in an Any, or pass it as an unconstrained generic parameter, we must maximally reabstract it. This fixes the value semantics of existentials containing trivial metatypes.
- To ensure that we get runtime layout of structs and enums correct when they contain reabstractable types, introduce a "metadata for layout" concept, which doesn't need to describe the canonical metadata for the type, but only needs to describe a type with equivalent layout and value semantics. This is a correctness fix that allows us to correctly lay out generic types containing dependent tuples and functions, and although we don't really take advantage of it here, it's also a potential runtime performance win down the road, because we could potentially produce direct metadata for a primitive type that's layout-equivalent with a runtime-instantiated type. To aid in type safety here, push SILType deeper into IRGen in places where we potentially care about specific representations of types.
- Finally, fix an inconsistency between the runtime and IRGen's concept of what spare bits unmanaged references and thick metatypes have.

Together, these fixes address rdar://problem/16406907, rdar://problem/17822208, rdar://problem/18189508, and likely many other related issues, and also fixes crash suite cases 012 and 024.

Swift SVN r21963
2014-09-16 01:44:34 +00:00
Doug Gregor
f7458a8e05 Update compiler-crashers testsuite r21946
Swift SVN r21952
2014-09-15 21:00:17 +00:00
Dmitri Hrybenko
ceff82f2ba stdlib/Array: add tests for Array -> NSArray bridging
Swift SVN r21939
2014-09-15 13:49:50 +00:00
Jordan Rose
ce07a7b4d1 [test] Actually set the 'asan' feature appropriately when validation testing.
Hopefully fixes the ASan bot.

Swift SVN r21915
2014-09-12 18:27:11 +00:00
Dmitri Hrybenko
d7acb06c64 stdlib/Dictionary: use 'delayed bridging' to keep pointers, returned
from a bridged NSDictionary, stable

We used to return a fresh pointer value every time an NSDictionary
element is requested, but, unfortunately, our SDK has bugs.

Fixes rdar://18191358 for Dictionary.

Swift SVN r21905
2014-09-12 13:20:30 +00:00
Dmitri Hrybenko
37562576af Update AtomicInt test for removal of any()
Swift SVN r21903
2014-09-12 09:24:34 +00:00
Joe Groff
6f64c4ce12 Update validation tests for raw -> rawValue change.
Swift SVN r21893
2014-09-11 22:27:01 +00:00
Dmitri Hrybenko
d68a5c4c98 stdlib: finish implementation of atomics for initializing an ARC
reference, add tests

Swift SVN r21873
2014-09-11 14:52:58 +00:00
Joe Pamer
ede74dd90e When solving for call witness argument conversions, post diagnostics in the case of failures rather than raise an assertion. This addresses crash suite issue 040. (rdar://problem/18233081)
Swift SVN r21852
2014-09-10 22:28:03 +00:00
Dmitri Hrybenko
96d00d70b5 StdlibUnittest: add infrastructure for race tests (see examples)
This will be used to test rdar://18191358

Swift SVN r21836
2014-09-10 11:58:45 +00:00
Dmitri Hrybenko
2c93cf71f0 Mark compiler_crashers/036-lisp-style.swift as passing
Swift SVN r21833
2014-09-10 08:07:47 +00:00
Joe Pamer
9bbf4ac5fe Improve diagnostic so as not to mystify users.
Swift SVN r21824
2014-09-10 01:52:07 +00:00
Joe Pamer
acce45bdc8 Lock down existential metatype to metatype coercions. Since they're currently unsupported, we'll display a semantic error rather than crash.
This addresses crash suite scenarios 011 and 013. (rdar://problem/17777218, rdar://problem/18232728)

Swift SVN r21822
2014-09-10 00:54:34 +00:00
Joe Pamer
aeef7f736f Now that we now longer crash, reinstate test.
Swift SVN r21818
2014-09-10 00:05:29 +00:00
Joe Pamer
fa692976f5 If an expression fails to type check, and there were no failures posted or constraints to mine for a reason, we can be fairly certain that the reason for the failure was a lack of contextual type data. In this case, we should post a diagnostic rather than let the failure slip through. This addresses crash suite scenarios 001, 005, 020 and 045. (rdar://problem/16712071, rdar://problem/17317691, rdar://problem/17317691)
You'll notice that emitting this diagnostic will make some already noisy closure-related errors slightly more so. This is unfortunate, but for the time-being it's better than crashing.

Swift SVN r21817
2014-09-09 23:58:59 +00:00
Jordan Rose
e5bfd3c5dd [test] Mark three known crashers as "XFAIL: asan".
We're going to crash anyway, we'll fix it when we fix the main issue, and
the main issue isn't memory-error-related. Should unblock the ASan bot.

Swift SVN r21814
2014-09-09 22:46:56 +00:00
Dmitri Hrybenko
decff06131 Remove the test that is duplicate with
test/IRGen/mixed_objc_native_protocol_constraints.swift

Swift SVN r21804
2014-09-09 06:55:24 +00:00
Joe Groff
419ba5cbea Change RawRepresentable to use failable initializers and property requirements.
Redefine the RawRepresentable protocol to use an 'init?' method instead of 'fromRaw(Raw)', and a 'raw' get-only property instead of 'toRaw()'. Update the compiler to support deriving conformances for enums and option sets with the new protocol. rdar://problem/18216832

Swift SVN r21762
2014-09-06 18:40:14 +00:00
Mishal Awadah
e5ca8be1a0 Add README with details on swift-compiler-crashes community repo.
Swift SVN r21717
2014-09-04 18:21:03 +00:00
Mishal Awadah
798315edd5 Add recent crasher test case from swift-compiler-crashes.
Swift SVN r21716
2014-09-04 18:21:02 +00:00
Dmitri Hrybenko
b6308cae7c Update UnicodeUTFEncoders for failable initializers
Swift SVN r21701
2014-09-04 11:11:12 +00:00
Mishal Awadah
d8ce0b80cb Add basic compilation tests from swift-compiler-crashes (https://github.com/practicalswift/swift-compiler-crashes.git)
Swift SVN r21693
2014-09-04 01:06:26 +00:00
Dmitri Hrybenko
8f2c13fa94 Add a prototype of new hashing APIs (so that it does not bit rot on my disk)
Unfortunately, I don't see how to ensure interoperability with Objective-C.


Swift SVN r21581
2014-08-29 16:57:45 +00:00
Dmitri Hrybenko
60cf5d3d1b SwiftIntTypes.py: remove transitional '_new' suffix from a function name
Swift SVN r21579
2014-08-29 15:38:22 +00:00
Dmitri Hrybenko
717171b89d stdlib tests: use simpler interface to iterate over integer types
Swift SVN r21577
2014-08-29 15:14:35 +00:00
Dmitri Hrybenko
2b6ccd2deb Add tests for traps in shift operations
Swift SVN r21575
2014-08-29 15:10:03 +00:00
Dmitri Hrybenko
cb9e5c2c86 stdlib: use simpler interface to iterate over integer types
Swift SVN r21573
2014-08-29 14:32:46 +00:00
Dmitri Hrybenko
c5181c2d65 stdlib/FixedPoint: fix hash computation for [U]Int64 on 32-bit platforms
It used to trap if the value of [U]Int64 was outside the Int32 range.

rdar://18113807

Swift SVN r21572
2014-08-29 13:48:32 +00:00
Dmitri Hrybenko
1bc40d22ef FixedPoint test: use correct argument order for expectEquals
Swift SVN r21571
2014-08-29 13:37:19 +00:00