Commit Graph

185 Commits

Author SHA1 Message Date
Robert Widmann
1d6f11ab54 Refactor ArrayExpr visitor for better QoI
Also remove mention of the word “contextual” type from the diagnostic
that rewrites array literals into dictionary literals and scale back
the scope of the diagnostic.  This method was catching and
mis-diagnosing too many errors that could better be handled by invalid
conversion diagnostics.
2017-12-15 18:20:36 -05:00
Graydon Hoare
c48abe70bb [Stats] Fix a stats-dir test that is asserts-mode sensitive. rdar://35537905 2017-12-12 16:41:47 -08:00
Bob Wilson
1bb16be108 Temporarily disable failing test: Misc/stats_dir_failure_count.swift
rdar://problem/35537905
2017-11-20 13:19:38 -08:00
Graydon Hoare
173e702da2 [Stats] Add a pair of counters to track failed processes. 2017-11-08 19:53:36 -08:00
Graydon Hoare
5d08866e56 [Stats] Warn on failure-to-write stats / trace files. 2017-10-05 19:06:06 -04:00
Graydon Hoare
a8ecfb2b92 [Stats] Add a test for long input-path bug (0e5b982d) 2017-10-04 13:59:49 -07:00
Graydon Hoare
5c7f5979ad [process-stats-dir] Add --exclude-timers option. 2017-09-13 14:59:08 -07:00
Graydon Hoare
c42b3b6bdb [process-stats-dir] Add --select-stat support. 2017-09-13 12:40:14 -07:00
Graydon Hoare
70dd15dc4a [Stats] Count SourceFile stats when in -wmo mode. 2017-08-22 16:39:00 -07:00
Graydon Hoare
04d11afdad [Stats] Collect IR/LLVM always-on stats correctly when multithreading. 2017-08-17 13:45:06 -04:00
Mark Lacey
0b173decf5 Merge pull request #11338 from rudkx/bail-on-too-complex
Remove -swift-version 3 checks for "expression too complex".
2017-08-04 14:45:35 -07:00
Mark Lacey
9e7b5b22db Remove -swift-version 3 checks for "expression too complex".
This was initially added to avoid "expression was too complex" in a
case where we were not previously reporting it for -swift-version 3
but should have been. In retrospect this seems misguided since
although we would not like to regress on "too complex" expressions, we
really don't want to silently continue in the cases where we decide an
expression is "too complex", but where we have a solution that we
could use. It's better to fail.
2017-08-03 20:33:07 -07:00
Bob Wilson
812a3223ba Update another instance of a "cortex-a8" to match LLVM r304390. 2017-07-31 13:55:38 -07:00
Bob Wilson
31c8ae0c5e Adjust expected test output to match LLVM r304390.
It is not clear to me if we want that LLVM change to apply to Apple
platforms, so I filed rdar://problem/33626867 to follow up on that.
2017-07-31 09:48:18 -07:00
Vivian Kong
7fe35b4d78 Set default CPU for s390x to support conversion between unsigned integers and floating point numbers (#9647) 2017-07-13 11:20:25 -07:00
Mark Lacey
e51e3e4bd4 Update determination of "too complex" expression to take time into account.
By default, end expression type checking after the elapsed process time
is more than 60 seconds for the current expression. This threshold can
be overridden by using -solver-expression-time-threshold=<seconds>.

Resolves rdar://problem/32859654
2017-06-21 16:26:34 -07:00
Mark Lacey
ee403963d2 Disable new test that is running into stack overflow in ASAN runs. (#10300)
Disable while this is being investigated in order to allow ASAN runs to
complete without failure.
2017-06-16 10:16:52 -07:00
Max Moiseev
90a20ea015 [stdlib] Resolve the ambiguity for Int32.init(bitPattern:)
When this initializer is invoked with an integer literal, the expression
is ambiguous, since both UIn32 and Float are
RepresentableByIntegerLiteral.

Fixes: https://bugs.swift.org/browse/SR-5176
2017-06-13 17:28:19 -07:00
Graydon Hoare
422266ac02 [Stats] Add test for -stats-output-dir and process-stats-dir.py 2017-06-02 23:49:52 -07:00
Slava Pestov
d63bf4ee41 Sema: Fix for bogus ParenType showing up in deduced associated types
When matching inputs of a function type, be sure to
strip off ParenType sugar so that we don't end up
with ParenTypes in associated type witnesses.

This fixes various issues with SE-0110.

Fixes <rdar://problem/32214649>.
2017-05-17 00:39:46 -07:00
Pavel Yaskevich
9a07f28ac4 Merge pull request #9587 from xedin/rdar-31973368
[QoI] Extend single tuple parameter diagnostics to function/subscript calls
2017-05-15 21:29:42 -07:00
Ben Cohen
df76500e9c Re-enable expression_too_complex test and bump memory to 12k per rdar://problem/31794148 (#9635) 2017-05-15 19:50:13 -07:00
Pavel Yaskevich
ead1447aa1 [QoI] Extend single tuple parameter diagnostics to function/subscript calls
Properly diagnose cases of function/subscript argument tuple
structuring/destructuring related by not limited to SE-0110.

Resolves: rdar://problem/31973368
2017-05-15 18:41:41 -07:00
Ben Cohen
ea2f64cad2 [stdlib] Add Sequence.Element, change ExpressibleByArrayLiteral.Element to ArrayLiteralElement (#8990)
* Give Sequence a top-level Element, constrain Iterator to match

* Remove many instances of Iterator.

* Fixed various hard-coded tests

* XFAIL a few tests that need further investigation

* Change assoc type for arrayLiteralConvertible

* Mop up remaining "better expressed as a where clause" warnings

* Fix UnicodeDecoders prototype test

* Fix UIntBuffer

* Fix hard-coded Element identifier in CSDiag

* Fix up more tests

* Account for flatMap changes
2017-05-14 06:33:25 -07:00
Argyrios Kyrtzidis
0bb299abc8 [frontend] Add 'finishProcessing()' method for DiagnosticConsumers to do their finalization (e.g. writing to a file)
Use this to avoid creating an empty serialized diagnostics file when the compiler crashes.
2017-05-05 18:25:02 -07:00
Michael Gottesman
9d2d4bb61d Fix the tbi test even harder.
A few things here:

1. I changed the .swift file to be a .sil file. This one is for Jordan. It
should also make the test not run into any issues due to swift level codegen
changes. So we should have an even more robust test.

2. I fixed the watchossimulator test by eliminating any dependency of this test
on an SDK. This is a pure compiler/target test. Just like the stdlib is not
necessary, SDKs are not necessary either.
2017-04-30 17:16:13 -07:00
Arnold Schwaighofer
66ed615d78 Disable test/Misc/tbi.swift
It is failing a bot

rdar://31887302
2017-04-28 08:05:07 -07:00
Michael Gottesman
d4289d65ec Update the TBI test to be conditional on the arm64 code generator instead of targeting arm64.
This ensures that we run the test during normal PR testing and hopefully ensures
I never have to fix this test again = ).

rdar://24370377
2017-04-27 11:42:07 -07:00
Michael Gottesman
6c27e7ef5b Remove all stdlib dependencies from the tbi test.
This should eliminate any deployment target issues that we may run into when
using this test.

rdar://24370377
2017-04-26 19:58:27 -07:00
Max Moiseev
9b53efd72c Merge branch 'master' into new-integer-protocols 2017-04-17 09:53:44 -07:00
Mark Lacey
1103e278c8 [Constraint solver] Tweak test based on using a bit more memory for -propagate-constraints.
This test is trying to confirm that memory usage is independent and that
follow-on expressions do not fail just because of the first failure, and
now we naturally fail on another expression because of the additional
memory used for -propagate-constraints.

Tweak the test to bump up the threshold and swap the order of
expressions so that the now-failing expression is first.
2017-04-15 20:18:09 -07:00
Max Moiseev
a3a3351bd8 Merge branch 'master' into new-integer-protocols 2017-04-10 15:41:13 -07:00
Jordan Rose
c1e4be1ad2 Catch llvm::report_fatal_error and try to emit a proper diagnostic. (#8639)
This only affects the textual output, but should still improve the
experience when we /do/ hit one of these LLVM errors. In addition to
showing up better in Xcode, it'll also give us a proper
PrettyStackTrace because of the call to abort() instead of exit(1).

(There's a bit of finger-crossing that the act of printing the
diagnostic doesn't cause more errors. I only tested the fallback
path a little.)
2017-04-10 10:40:03 -07:00
Max Moiseev
835b8809d2 Merge branch 'master' into new-integer-protocols 2017-03-07 16:18:54 -08:00
Graydon Hoare
1c3be5ce66 Followup to rdar://29684330 to include expected-error comment. 2017-02-06 16:53:09 -08:00
Graydon Hoare
9cb1c52fd8 Count constraint-solving memory more precisely, rdar://29684330 2017-02-06 13:04:19 -08:00
Max Moiseev
b5d25cc92f Fixing the tests (again) 2017-01-27 17:49:32 -08:00
Max Moiseev
1814e4fce3 Fixing tests 2017-01-23 10:59:31 -08:00
Max Moiseev
a872adad8f Fixing and XFAILing tests 2017-01-10 15:38:17 -08:00
Ben Cohen
465f243943 Move += operator for append(contentsOf:) up to RangeReplaceableCollection 2017-01-05 11:59:49 -08:00
Doug Gregor
dcdef4f7f5 [Type checker] Improve "downcast only unwraps optionals" diagnostics.
Specialize and improve the "downcast only unwraps optionals"
diagnostic to provide specific diagnostics + Fix-Its for the various
casts of forced cast, conditional cast, and "isa" check. Specifically:

* With a forced cast, customize the diagnostic. We still insert the
  appropriate number of !'s, but now we remove the 'as! T' (if an
  implicit conversion would suffice) or replace the 'as!' with 'as'
  (if we still need a bridge)

* With a conditional cast, only emit a diagnostic if we're removing
  just one level of optional. In such cases, we either have a no-op
  (an implicit conversion would do) or we could just use 'as' to the
  optional type, so emit a customized warning to do that. If we are
  removing more than one level of optional, don't complain:
  conditional casts can remove optionals. Add the appropriate Fix-Its
  here.

* With an 'is' expression, only emit a diagnostic if we're removing
  just one level of optional. In this case, the 'is' check is
  equivalent to '!= nil'. Add a Fix-It for that.

Across the board, reduce the error to a warning. These are
semantically-well-formed casts, it's just that they could be written
better.

Fixes rdar://problem/28856049 and rdar://problem/22275685.
2016-12-21 13:47:19 -08:00
Doug Gregor
e97ab635ea [Constraint solver] Separate bridging conversions from other conversions.
Previously, bridging conversions were handled as a form of "explicit
conversion" that was treated along the same path as normal
conversions in matchTypes(). Historically, this made some
sense---bridging was just another form of conversion---however, Swift
now separates out bridging into a different kind of conversion that is
available only via an explicit "as". This change accomplishes a few
things:

* Improves type inference around "as" coercions. We were incorrectly
  inferring type variables of the "x" in "x as T" in cases where a
  bridging conversion was expected, which cause some type inference
  failures (e.g., the SR-3319 regression).

* Detangles checking for bridging conversions from other conversions,
  so it's easier to isolate when we're applying a bridging
  conversion.

* Explicitly handle optionals when dealing with bridging conversions,
  addressing a number of problems with incorrect diagnostics, e.g.,
  complains about "unrelated type" cast failures that would succeed at
  runtime.

Addresses rdar://problem/29496775 / SR-3319 / SR-2365.
2016-12-21 13:46:14 -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
2024316e38 [gardening] Remove accidental trailing whitespace (" " and "\t") 2016-10-30 10:59:02 +01:00
Pavel Yaskevich
dd01b7e184 [Diagnostics] SR-2208: Improve failure diagnostics for apply expressions 2016-10-26 14:34:05 -07:00
practicalswift
c4a6c054b1 Merge pull request #4855 from practicalswift/spacing-consistency
[gardening] Increase consistency with regards to spacing after colons
2016-09-23 11:20:23 +02:00
Slava Pestov
e97df4a285 Sema: Implicit conversion for single-expression closures of Never type
This fixes a usability regression with the removal of @noreturn
in Swift 3. Previously, it was legal to write this:

let callback: () -> Int = { fatalError() }

Now that the special @noreturn attribute has been replaced with
a Never type, the above fails to typecheck, because the expression
now has type 'Never', and we expect a value of type 'Int'.

Getting around this behavior requires ugly workarounds to force the
parser to treat the body as a statement rather than an expression;
for example,

let callback: () -> Int = { _ = (); fatalError() }

This patch generalized single-expression closures to allow
the 'Never to T' conversion. Note that this is rather narrow
in scope -- it only applies to closure *literals*, single-expression
ones at that, not arbitrary function *values*.

In fact, it is not really a conversion at all, but more of a
desugaring rule for single-expression closures. They can now be
summarized as follows:

- If the closure literal has contextual return type T and
  the expression has Never type, the closure desugars as
  { _ = <expr> }, with no ReturnStmt.

- If the closure literal has contextual return type T for some
  non-void type T, the closure desugars as { return <expr> };
  the expression type must be convertible to T.

- If the closure literal has contextual return type Void, and
  the expression has some non-Void type T, the closure
  desugars as { _ = <expr>; return () }.

Fixes <rdar://problem/28269358> and <https://bugs.swift.org/browse/SR-2661>.
2016-09-22 23:40:25 -07:00
practicalswift
ef8e43b519 [gardening] Increase consistency with regards to spacing after colons 2016-09-22 16:28:57 +02:00
swift-ci
1bce73a7a8 Merge pull request #4851 from modocache/remove-superfluous-serialize-diagnostics 2016-09-19 11:54:16 -07:00
practicalswift
fa7fbdb8b0 [gardening] Remove redundant nil-initialization of optional variable
From the Swift documentation:

"If you define an optional variable without providing a default value,
 the variable is automatically set to nil for you."
2016-09-18 07:40:07 +02:00