Commit Graph

82 Commits

Author SHA1 Message Date
Meghana Gupta
f458d9b490 Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag (#39516)
* Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag

This includes a bit in the module format to represent if the module was
compiled with -enable-ossa-modules flag. When compiling a client module
with -enable-ossa-modules flag, all dependent modules are checked for this bit,
if not on, recompilation is triggered with -enable-ossa-modules.

* Updated tests
2021-10-04 18:46:40 -07:00
Frederick Kellison-Linn
00004482c9 Add unit tests for placeholder type inference 2021-10-01 12:45:56 -04:00
zoecarver
d706863a52 [cxx-interop][nfc] Add a ClangImporter request zone.
This is just the boilerplate for adding a request zone. I haven't actually added any requrests in this commit.
2021-09-28 17:08:48 -07:00
Victoria Mitchell
ff766fce37 add ASTContext symbol-graph arg in unit tests 2021-07-01 09:05:02 -06:00
Pavel Yaskevich
038761f795 [TypeChecker] NFC: Add a unittest for closure inference with optional contextual type 2021-06-25 08:33:14 -07:00
Pavel Yaskevich
8dc2251a7e [CSBindings] NFC: Add a unit test for closure result inference
Make sure that `Void` doesn't get attempted twice if it was
inferred directly or transitively.
2021-06-17 14:11:59 -07:00
Pavel Yaskevich
51ff12d06e [ConstraintLocator] Augment ContextualType element to carry its purpose
Having purpose attached to the contextual type element makes it much
easier to diagnose contextual mismatches without involving constraint
system state.
2021-04-26 09:51:21 -07:00
Nathan Hawes
c57c403ffa [ConstraintSystem] Record parameter bindings in solutions (NFC)
This saves us from needing to re-match args to params in CSApply and is also
useful for a forthcoming change migrating code completion in argument position
to use the solver-based typeCheckForCodeCompletion api.

rdar://76581093
2021-04-16 18:32:06 +10:00
Pavel Yaskevich
d310f37ffc [CSBindings] Infer transitive protocols only for unresolved member base
Nothing besides static member refs on protocols feature is currently
using transitive protocols, so instead of trying to infer them on every
step let's do that only for base type of a dot-syntax reference when
there are no other bindings for it.
2021-03-30 13:39:24 -07:00
Pavel Yaskevich
56c96c6b50 [CSBindings] Use all equivalence chain members while interring transitive protocols
Currently inference logic only checked direct equivalence class members
associated with a "work-in-progress" type variable, but each member can
have local equivalences as well that need to be accounted for.

Resolves: rdar://75978086
2021-03-30 13:39:12 -07:00
Pavel Yaskevich
1817ddcc5e [CSBindings] Always finalize binding set unless explicitly asked not to 2021-02-24 10:38:31 -08:00
Pavel Yaskevich
fbc11f410a [ConstraintSystem] Implement incremental binding computation 2021-02-24 10:37:20 -08:00
Pavel Yaskevich
df7af0078f [CSBindings] Separate inference storage from final product usable by the solver
`PotentialBindings` lost most of its responsibilities,
and are no longer comparable. Their main purpose now
is binding and metadata tracking (introduction/retraction).

New `BindingSet` type is something that represents a set
of bindings at the current step of the solver.
2021-02-24 10:37:20 -08:00
Pavel Yaskevich
5b55ea1312 [CSGen] Use new UnresolvedMemberChainBase constraint 2021-02-23 11:33:10 -08:00
Pavel Yaskevich
72888ca29b [ConstraintSystem] NFC: Extract PotentialBindings and auxiliary struct from ConstraintSystem
This opens up a posibility of using `PotentialBindings`
in `ConstraintGraphNode` and other places in `ConstraintGraph`.
2021-01-15 15:03:54 -08:00
Pavel Yaskevich
03b6b41774 [CSBindings] NFC: Don't pass constraint system as an argument to infer* methods
`PotentialBindings` already reference the constraint system they
belong to, so there is no need to pass it as an argument to inference
methods.
2021-01-12 00:53:46 -08:00
Pavel Yaskevich
1ed2f62e88 [unittests/Sema] NFC: Add tests for literal requirement inference/coverage
Test that literal requirements are:

- inferred correctly (both direct and transitive);
- covered by direct/transtiive bindings.
2021-01-05 11:52:48 -08:00
Pavel Yaskevich
25fff2c4f2 [unittests/Sema] NFC: Adjust binding inference test to reflect binding set changes 2021-01-05 08:56:59 -08:00
Evan Wilde
6dac520b66 NFC: Fix signed unsigned comparison warnings
This patch fixes the unsigned/signed comparison warnings in the
unittests caused by comparing an unsigned integer with the signed
integer literal. The offending signed integer literals have been
replaced with unsigned integer literals.
2020-12-10 16:02:33 -08:00
Frederick Kellison-Linn
6b0f5da001 [Unit tests] Add unit tests for optional lookup behavior 2020-12-04 12:11:10 -05:00
Pavel Yaskevich
a0a37d2a71 Merge pull request #34356 from xedin/record-trailing-even-if-types-are-equal
[ConstraintSystem] Record trailing choice match choice when arguments…
2020-10-19 16:20:00 -07:00
Pavel Yaskevich
340d1e843a [ConstraintSystem] Record trailing choice match choice when arguments/result are equivalent to applied function 2020-10-19 13:55:55 -07:00
Pavel Yaskevich
9598f19848 [unittest/Sema] Cover transitive protocol inference with unit tests 2020-10-15 16:27:36 -07:00
Pavel Yaskevich
a3c3981a68 [unittest/Sema] NFC: Add a way to create a protocol with a given name and parent type 2020-10-15 16:27:36 -07:00
Pavel Yaskevich
a243831122 [unittest/Sema] Add a test-case for a single hop protocol requirement inference
In situations like:

`$T0 <convertible> $T1`
`$T1 <conforms to> P`

`$T0` should know about `P` as a transitive protocol requirement.
2020-10-15 16:27:35 -07:00
Pavel Yaskevich
1aecea17e4 [unittest/Sema] Add a helper method to infer bindings for a given type variable
This mimics what `determineBestBindings` does but without sorting.
2020-10-15 16:27:35 -07:00
Pavel Yaskevich
fde1af756d [unittest/Sema] Use default target triple to fix Windows build 2020-10-13 13:52:24 -07:00
Pavel Yaskevich
6e470f5fcd [unittest/Sema] NFC: Switch to use AttributedImport instead of deprecated ImportedModuleDesc 2020-10-13 00:12:09 -07:00
Pavel Yaskevich
dc7c9c2bfa [unittests/Sema] Add a simple integer literal type inference test 2020-10-12 18:57:20 -07:00
Pavel Yaskevich
b2c31c394b [unittests/Sema] Add an ability to retrieve stdlib types by name 2020-10-12 18:57:20 -07:00
Pavel Yaskevich
0b22d91c94 [unittests] Extend Sema testing fixture to load stdlib (+ shims)
Setup module importers, load stdlib, establish separate testing
module and load a single main file there which imports standard
library.
2020-10-12 18:57:20 -07:00
Pavel Yaskevich
9239692d00 [unittests] Add a fixture for Sema unit tests 2020-10-12 18:57:20 -07:00