Commit Graph

12650 Commits

Author SHA1 Message Date
Pavel Yaskevich
53a9b1f9b9 Merge pull request #23312 from xedin/form-complete-member-overload-sets
[ConstraintSystem] Include unviable-by-fixable choices into member overload sets
2019-03-18 13:43:52 -07:00
Arnold Schwaighofer
a2c651504c Merge pull request #23337 from aschwaighofer/support_dynamic_replacement_of_stored_with_observer
Add support for dynamic replacement of didSet/willSet
2019-03-18 11:18:21 -07:00
Azoy
2bd99eecae clean up subs
value interface type
2019-03-18 00:06:24 -05:00
Suyash Srijan
4eebc8e46f [Sema] Don't attempt to derive raw representable conformance if the enum elements have a payload 2019-03-16 23:39:13 +00:00
John Holdsworth
dbe99d771e Make Self available to member functions (SE-0068?) (#22863)
* Make Self available to instance member functions (SE-0068?)

* Works for value types and static functions.

* Further experiments with TypeExpr

* Move Self processing off diagnostic path

* diagnostic instead of assertion fail

* TypeExpr of DynamicSelfType now working.

* Update tests for availability of Self

* Cast to Self fixed!

* Self not available as type in classes except for return type

* Could it be this simple?

* Nearly there

* Fix function decls using Self inside methods.

* Fix validation-test/compiler_crashers_2_fixed/0164-sr7989.swift

* Fix of ./validation-test/compiler_crashers_2_fixed/0179-rdar44963974.swift

* "Un-fix" validation-test/compiler_crashers_2_fixed/0164-sr7989.swift

* CHANGELOG entry

* Update CHANGELOG.md

Co-Authored-By: johnno1962 <github@johnholdsworth.com>

* Update CHANGELOG.md
2019-03-15 23:23:19 -04:00
Suyash Srijan
c79e6ec7f6 [typechecker] dont infer @objc for typealiases inside @objc protocol 2019-03-16 01:01:15 +00:00
Arnold Schwaighofer
35ca0e3423 Add support for dynamic replacement of didSet/willSet
The observer in a dynamic replacement of variables with a observer will
provide the dynamic replacement for the original.

var original : Int = 0 {
  didSet {
    print("original")
  }
}

@_dynamicReplacement(for: original)
var replacement : Int = 0 {
  didSet {
    print("replacement")
  }
}

rdar://48518788
2019-03-15 16:30:03 -07:00
Rintaro Ishizaki
dcb1db26bb [AST] Don't return decls from unsatisfied conformance
When a type conditionally conforms to a protocol, it used to provide
symbols from extension to that protocol.
e.g.:

  protocol P {}
  extension P {
    func foo() {}
  }

  struct S<T> {}
  extension S: P where T == Int {}

  func test(val: S<String>) {
    val.#^COMPLETE^#
  }

This should not provide `foo()` method.

rdar://problem/36594731
2019-03-15 15:52:07 -07:00
Michael Gottesman
8d3d95299e [gardening] Extract out checking of fallthrough pattern bindings and types into its own helper method.
This is the last "subroutine" I am extracting from StmtChecker::visitSwitchStmt.
It is possible to read easily now without getting lost.
2019-03-15 12:33:30 -07:00
Michael Gottesman
f241f102ee [gardening] Extract out checking of @unknown attr from visitSwitchStmt into a helper method. 2019-03-15 12:33:30 -07:00
Michael Gottesman
181ca353ea [gardening] Extract out type checking of case label items into its own helper method.
The method StmtChecker::visitSwitchStmt is really large and does a bunch of
different things. This implicit submethod was one of the largest of these. By
extracting this, we make the original method easier to reason about.

Extracting done with Xcode's refactoring engine.
2019-03-15 12:33:30 -07:00
swift-ci
e038f7e0c3 Merge pull request #23329 from gottesmm/pr-2679b77f4cbae71992789447ad73841ac6504842 2019-03-15 12:31:29 -07:00
Slava Pestov
8e14023868 Merge pull request #23280 from slavapestov/enable-resilience-flag
Rename -enable-resilience to -enable-library-evolution and make it a driver flag
2019-03-15 14:26:16 -04:00
Michael Gottesman
d1b6060285 [gardening] Make capitalization/style consistent in StmtChecker::visitSwitchStmt. 2019-03-15 11:06:35 -07:00
Arnold Schwaighofer
2d0fe53724 Merge pull request #23306 from aschwaighofer/fix_dynamic_replacement_undeclared_type_crash
Sema: Fix a crash when checking dynamic replacements on a non existing type
2019-03-15 10:18:05 -07:00
Suyash Srijan
896773ec07 [typechecker] check for casts from existential types to concrete types 2019-03-15 16:40:52 +00:00
Rintaro Ishizaki
00874e9b18 Merge pull request #23065 from rintaro/ast-visibledecls-inapplicable-rdar36594731
[AST] Don't return inapplicable decls in lookupVisibleDecls
2019-03-15 09:27:14 -07:00
swift-ci
19015faa84 Merge pull request #23252 from brentdax/the-name-blame-game 2019-03-15 02:03:14 -07:00
Pavel Yaskevich
852169a5f5 [ConstraintSystem] Split unviable lookup result storage into candidates & reasons
That makes it easy to process unviable choices the same way as viable
ones and request rejection reasons only when necessary.
2019-03-14 22:20:20 -07:00
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00
Slava Pestov
9626340d4b Sema: Remove unused -fix-string-to-substring-conversion flag 2019-03-14 22:08:43 -04:00
Pavel Yaskevich
fd377dc46b [CSSimplify] Fix unviable "instance member on metatype" choice
Adjust base type and reference kind so it looks as-if
it is a correct reference when used by constraint system.
2019-03-14 13:34:39 -07:00
Pavel Yaskevich
8de1763ba0 [ConstraintSystem] Record both viable and unviable candidates produced by lookup
Try to form a "complete" set of overload choices based on lookup
results, which means include both viable and unviable-but-fixed
candidates for solver to attempt. Latter are going to be skipped
until "salvage" mode so there should be no overhead for the solver
in "performance first" mode.
2019-03-14 13:18:42 -07:00
Pavel Yaskevich
8b5396bbac [CSSolver] Attempt disabled disjunction choices only if they have a fix
This draws a distinction between disabled choices with and without
fixes - former is disabled because it's unrelated, latter because
it only makes sense to attempt it during "salvage" mode while trying
to produce diagnostics.
2019-03-14 13:18:42 -07:00
Pavel Yaskevich
be99082598 [Constraint] Disable "fixed" overload choice by default 2019-03-14 13:18:42 -07:00
Pavel Yaskevich
bdf21be00c [ConstraintSystem] NFC: Add hasFix() to DisjunctionChoice 2019-03-14 13:18:42 -07:00
Rintaro Ishizaki
b006c7c9b8 [AST] Don't return inapplicable decls in lookupVisibleDecls
rdar://problem/45340583 / https://bugs.swift.org/browse/SR-9027
rdar://problem/36594731
2019-03-14 12:57:37 -07:00
Arnold Schwaighofer
36e210a34e Sema: Fix a crash when checking dynamic replacements on a non existing type
rdar://48584489
2019-03-14 12:02:32 -07:00
Azoy
bc7cb332df Fix generic types
add tests

get parent init
2019-03-14 04:07:24 -05:00
Suyash Srijan
091fa17b45 [typechecker] don't check for error conformance until we know we're casting from Error 2019-03-14 00:34:58 +00:00
Azoy
e8bc662b35 Cleanups from Slava's comments
update module format
2019-03-13 18:58:45 -05:00
Azoy
6d00a5758f Disallow default values for patterns binding multiple variables
lets not add !
2019-03-13 18:57:36 -05:00
Azoy
6f7d20b99e Synthesize default values for memberwise init
Introduce stored property default argument kind

Fix indent

Assign nil to optionals with no initializers

Don't emit generator for stored property default arg

Fix problem with rebase

Indentation

Serialize stored property default arg text

Fix some tests

Add missing constructor in test

Print stored property's initializer expression

cleanups

preserve switch

complete_constructor

formatting

fix conflict
2019-03-13 18:57:36 -05:00
Suyash Srijan
ef6a7410f0 [typechecker] remove protocol conformance diagnostic when type does not conform to Error when using is pattern in catch statement 2019-03-13 22:35:26 +00:00
Pavel Yaskevich
7633d012e5 [ConstraintSystem] Attach fixes to incorrectly referenced or unviable overloads
Instead of waiting until the overload is attempted, let's figure out
if there is anything wrong with it beforehand and attach a fix to the
"bind overload" constraint representing it.
2019-03-13 12:09:12 -07:00
Pavel Yaskevich
7f39a94899 Merge pull request #23245 from xedin/further-simplify-add-overload-choice
[ConstraintSystem] Move "outer" candidates handling to `simplifyMembe…
2019-03-12 18:01:38 -07:00
Pavel Yaskevich
558c63b765 Merge pull request #23247 from xedin/add-fix-to-bind-overload
[Constraint] Add an ability to attach a fix to `BindOverload` constraint
2019-03-12 16:52:27 -07:00
Brent Royal-Gordon
1204c826ed [squash this] Simplify weak/unowned handling 2019-03-12 16:39:54 -07:00
Brent Royal-Gordon
a0a629f49a [squash this] Style fixes 2019-03-12 16:39:23 -07:00
Brent Royal-Gordon
f2102fccf8 Fix name confusion in Decodable synthesis
Decodable’s init(from:) synthesis sometimes mistook a static property for an identically-named instance property, which could cause it to skip a property or possibly make other mistakes. This change factors a common helper function from encode(to:) and init(from:) synthesis which implements the right logic for both.
2019-03-12 16:32:21 -07:00
Pavel Yaskevich
179a04446c [Constraint] Add an ability to attach a fix to BindOverload constraint 2019-03-12 15:11:32 -07:00
Pavel Yaskevich
70c59afb40 [ConstraintSystem] Move "outer" candidates handling to simplifyMemberConstraint
Further simplify `addOverloadSet` and move "outer" candidate handling
to the only place where it comes up - `simplifyMemberConstraint`.
Also move constraint generation for choices into a separate method.

This is a stepping stone on the path to enable attaching fixes to
the overload choices.
2019-03-12 14:46:35 -07:00
Pavel Yaskevich
9802875ce1 Merge pull request #23187 from theblixguy/fix/SR-10062
[Typechecker] Disallow default argument to inout parameter
2019-03-12 12:11:00 -07:00
Rintaro Ishizaki
2924be7ba0 Merge pull request #23192 from rintaro/ide-completion-infix-rdar48648877
[CodeCompletion] Fixed a crasher regarding malformed operator decl
2019-03-12 11:20:37 -07:00
Suyash Srijan
e21430a6af [typechecker] disallow default argument to inout parameter 2019-03-12 02:57:28 +00:00
Pavel Yaskevich
d9642d0b61 Merge pull request #23223 from xedin/followup-to-add-overload-set-cleanup
[ConstraintSystem] Prefer a single local choice over outer alternatives
2019-03-11 18:16:08 -07:00
Pavel Yaskevich
54290c7840 [ConstraintSystem] Prefer a single local choice over outer alternatives
This is a follow-up to https://github.com/apple/swift/pull/23194,
which broke a case were single local overload choice was preferred
over any number of outer alternatives.
2019-03-11 17:01:15 -07:00
David Zarzycki
558a318ebb Merge pull request #23215 from davezarzycki/qoi_report_all_tuple_type_errors
[Sema] QoI: Report all tuple type resolution errors
2019-03-11 17:39:48 -04:00
Suyash Srijan
0ee00843de [typechecker] Emit error diagnostic if the type in is-pattern does not conform to error and we're in a catch statement 2019-03-11 21:33:47 +00:00
David Zarzycki
31d8153097 [Sema] QoI: Report all tuple type resolution errors
This improves single pass diagnostics when more than one tuple type
element has problems.
2019-03-11 16:03:17 -04:00