Commit Graph

35 Commits

Author SHA1 Message Date
Erik Eckstein
78ec15cf38 tests: remove some unused FileCheck prefix options
Such tests would fail with the -allow-unused-prefixes FileCheck option.

diff --git a/test/lit.cfg b/test/lit.cfg
-run_filecheck = '%s %s --sanitize BUILD_DIR=%s --sanitize SOURCE_DIR=%s --use-filecheck %s %s' % (
+run_filecheck = '%s %s --sanitize BUILD_DIR=%s --sanitize SOURCE_DIR=%s --use-filecheck %s %s -allow-unused-prefixes=false' % (

It helps avoiding some wrong CHECK patterns.
I just looked briefly at some of the fails. TODO: fix remaining tests, too.

rdar://74189761
2021-03-25 15:19:30 +01:00
Erik Eckstein
41c17a5b0c IRGen: emit type metadata and (value) witness tables lazily.
This gives big code size wins for unused types and also for types, which are never used in a generic context.
Also it reduces the amount of symbols in the symbol table.
The size wins heavily depend on the project. I have seen binary size reductions from 0 to 20% on real world projects.

rdar://problem/30119960
2017-03-10 12:50:43 -08:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Joe
a6dad0091b [SE-0095] Initial parsing implementation for '&' composition syntax
This commit defines the ‘Any’ keyword, implements parsing for composing
types with an infix ‘&’, and provides a fixit to convert ‘protocol<>’

- Updated tests & stdlib for new composition syntax
- Provide errors when compositions used in inheritance.
Any is treated as a contextual keyword. The name ‘Any’
is used emit the empty composition type. We have to
stop user declaring top level types spelled ‘Any’ too.
2016-07-19 12:01:02 -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
Slava Pestov
67a1f24d59 Sema: 'dynamic' attribute now diagnoses if Foundation is not imported
This prevents us from seeing a less useful error message from SILGen
further down the line.

Also fix a bug where @objc without importing Foundation was not diagnosed
after the first top-level form. Some tests were relying on this behavior,
so fix those tests, either by splitting off the objc parts of the test, or
just by passing the -disable-objc-attr-requires-foundation-module flag.

Fixes <rdar://problem/20660270>.

Swift SVN r29359
2015-06-10 01:18:27 +00:00
Arnold Schwaighofer
859fbc0162 More executable_test for the test directory
Swift SVN r29280
2015-06-03 23:28:51 +00:00
Arnold Schwaighofer
7e010855b3 After Slava's changes this test now passes check-swift-optimize.
Swift SVN r28728
2015-05-18 22:59:34 +00:00
Arnold Schwaighofer
a4376cd5c7 XFAIL test for optimized swift_test_mode until we have a fix
rdar://20920874

Swift SVN r28672
2015-05-17 02:42:25 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Chris Lattner
31c01eab73 Change the meaning of "if let x = foo()" back to Xcode 6.4 semantics. The compiler
includes a number of QoI things to help people write the correct code.  I will commit
the testcase for it as the next patch.

The bulk of this patch is moving the stdlib, testsuite and validation testsuite to
the new syntax.  I moved a few uses of "as" patterns back to as? expressions in the 
stdlib as well.



Swift SVN r27959
2015-04-30 04:38:13 +00:00
Joe Groff
86157d533e Runtime: Reenable metatype casting code when ObjC interop is disabled.
Fixes rdar://problem/20583365, and incidentally gets test/Interpreter/layout_reabstraction.swift to work without ObjC interop as well.

Swift SVN r27557
2015-04-22 03:49:12 +00:00
Dmitri Hrybenko
384ff12e1d Annotate tests that require ObjC runtime
Swift SVN r27431
2015-04-17 10:09:23 +00:00
Dmitri Hrybenko
da7d906552 Fix warnings in protocol_lookup.swift
Swift SVN r27422
2015-04-17 06:12:45 +00:00
Doug Gregor
22cddeec6c Add test for rdar://problem/17179967.
Swift SVN r27232
2015-04-11 04:40:14 +00:00
Dmitri Hrybenko
1c3fe65f4f Fix tests for swift_conformsToProtocol that I broke for OS X in r25972
Swift SVN r25973
2015-03-11 06:12:24 +00:00
Dmitri Hrybenko
85764fd6aa runtime: fix two bugs in swift_conformsToProtocol on Linux
First, on x86-64 Linux does not reserve lower 2 Gb of the address space,
and a space saving trick in the runtime did not work properly, confusing
pointers and failure generation numbers together.

Second, we ignored protocol conformances inside the executable (only
considered shared libraries).

Swift SVN r25972
2015-03-11 05:54:11 +00:00
Graham Batty
83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00
Doug Gregor
2bf69a0ea0 Require witnesses for @objc requirements to be @objc.
Previously, we attempted to infer @objc-ness based on conformance, but
doing so is fraught with ordering dependencies, and just doesn't work
in the general case. Among other crimes, this allowed us to
retroactively mark a non-@objc method from an imported module as
@objc... even though nobody would ever then emit the @objc entry
points for it.

Fixes the rest of rdar://problem/18383574.

Swift SVN r24831
2015-01-29 22:53:53 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Graham Batty
83f27a8af7 Revert "Mark tests that don't pass on linux as XFAIL."
This reverts commit 2711ca86de7bf6a7885ccea24219a48a590b1e95.

Swift SVN r23577
2014-11-24 17:42:13 +00:00
Graham Batty
198402dcfe Mark tests that don't pass on linux as XFAIL.
Swift SVN r23573
2014-11-24 17:40:37 +00:00
Joe Groff
4c0e64f1da Handle class-constrained generic class-to-objc-existential casts.
Fixes rdar://problem/18638625.

Swift SVN r23324
2014-11-14 19:51:20 +00:00
Joe Groff
e5acb5be5c Don't die on a failed dynamicCastUnknownClass cast.
This still fails incorrectly in some cases, but we shouldn't crash the program. Part of rdar://problem/18638625

Swift SVN r23322
2014-11-14 18:16:51 +00:00
Joe Groff
b5b860ad39 IRGen: Properly create ObjC protocols using the runtime in JIT mode.
Just injecting a new protocol descriptor into an already-running ObjC runtime isn't a good idea, since the runtime might have already canonized the protocol somewhere else, and it won't recognize that classes conform to protocols it doesn't know about.

Swift SVN r23313
2014-11-14 01:01:02 +00:00
Joe Groff
412b1332f9 Runtime: Fix crash in cast to existential metatype.
Handle a null conformances pointer in _conformsToProtocol, and when we want to overwrite a metatype, pass a correct conformances pointer for the existential metatype value.

Swift SVN r23304
2014-11-13 17:36:07 +00:00
Joe Groff
fbd707fc91 Execution tests for class existential casts.
Metatype existential casts are still getting rejected by Sema.

Swift SVN r23238
2014-11-11 18:51:10 +00:00
Joe Groff
0fe904bbd9 Add tests for existential-to-existential casts.
Swift SVN r23159
2014-11-07 18:05:23 +00:00
Joe Groff
cfa876b440 Use 'as? Protocol' casts in tests instead of a hacked-up entry point.
This exposes an issue with CF types. Looking up their dynamic types gives us an ObjC class, which doesn't necessarily have the same protocol conformances (and for non-bridged types is just NSObject).

Swift SVN r23153
2014-11-07 02:28:18 +00:00
Joe Groff
e773d9a1aa IRGen: Unique the metadata for imported structs and enums at runtime.
Move the uniquing information for ForeignTypeMetadata behind the address point so we can share the layout between foreign classes and the existing layout for struct and enum metadata. Emit metadata records for imported structs and enums as foreign metadata candidates, and dynamically unique references to the metadata by calling swift_getForeignTypeMetadata.

Swift SVN r23081
2014-11-03 06:12:13 +00:00
Joe Groff
2b3e4f0dd7 Update todo
Swift SVN r23069
2014-11-02 21:03:19 +00:00
Joe Groff
efa166c443 IRGen: Don't lazily emit witness tables.
With runtime conformance lookup, it isn't possible without more complex analysis to determine whether a witness table is needed at runtime. In particular, in whole-module mode, it looked like no protocol conformances in the test/Interpreter/protocol_lookup.swift test were used, causing all of the tests to fail in -i mode. Erik's been working on SIL-level dead witness elimination which will hopefully offset the compile time hit here.

Swift SVN r23067
2014-11-02 19:18:38 +00:00
Joe Groff
01554448fc Runtime: Walk up superclass chains to find class conformances.
Swift SVN r23065
2014-11-02 15:41:00 +00:00
Joe Groff
139bf0323d Runtime: Cache nondependent generic witnesses for lookup.
We can share a lookup cache entry under the generic metadata pattern when the witness table for a protocol conformance is shared among all instances of the type. (This happens to always be the case currently.)

Swift SVN r23062
2014-11-02 01:17:14 +00:00
Joe Groff
2dc7678253 Runtime: Handle the easy cases for protocol lookup.
Set up the basic logic for first looking into a cache then pulling in conformances from enqueued images and trying again for exact-matchable types (pretty much just nongeneric native value types).

Swift SVN r23053
2014-11-01 02:46:52 +00:00