Hamish Knight
23e3f5f5de
Merge pull request #77666 from hamishknight/lets-try-this-again
...
[AST] Remove `ModuleDecl::addFile`
2024-11-21 20:15:58 +00:00
Allan Shortlidge
afad02e393
AST: Adopt AvailableAttr::isLanguageVersionSpecific().
2024-11-21 09:10:36 -08:00
Allan Shortlidge
36230cd9c6
AST: Use an accessor to get the PlatformKind from an AvailableAttr.
2024-11-21 09:10:36 -08:00
Hamish Knight
68648f74ef
[CS] Use adjusted type for single curry thunks
...
This matches the double curry thunk logic and
ensures that the resulting autoclosure matches the
expected type of the reference, avoiding mismatches
with parent expressions.
rdar://140212823
2024-11-21 12:14:00 +00:00
Hamish Knight
683c7ceb31
[CS] Simplify opened types earlier in buildMemberRef
...
Doesn't seem to be any reason not to do this
up-front, cleans up the code a little. Should be
NFC.
2024-11-21 12:13:59 +00:00
Hamish Knight
4d668e7b42
[Sema] Respect global actors on autoclosures
...
Previously we would only respect global actors
set on explicit closure expressions. Respect them
on autoclosures too.
2024-11-21 12:13:59 +00:00
Slava Pestov
25252cd683
Merge pull request #77728 from slavapestov/cg-cleanup
...
Sema: Small ConstraintGraph cleanup
2024-11-20 19:43:42 -05:00
Slava Pestov
8b61c9b442
Merge pull request #77723 from slavapestov/too-complex-stats
...
Sema: Progress towards an improved "too complex" check
2024-11-20 19:43:32 -05:00
Andrew Trick
cf1a946786
Give ~Escapable _read accessors with borrow scope borrowed ownership
...
This applies to all _read accessors whose result depends on a borrow
of self. In this case, the coroutine defines the borrow scope, and the
~Escapable property value can only be used within that scope. This
makes it impossible to synthesize a getter. Returning the ~Escpable
value from the getter would always escape the coroutine.
2024-11-20 11:28:54 -08:00
Slava Pestov
7fef225c9f
Sema: Allow turning off expression timer with -solver-expression-time-threshold=0
2024-11-20 13:46:19 -05:00
Slava Pestov
c8415aeac4
Sema: Record the trail step count in solver statistics
...
Also introduce two new frontend flags:
The -solver-scope-threshold flag sets the maximum number of scopes, which was
previously hardcoded to 1 million.
The -solver-trail-threshold flag sets the maximum number of trail steps,
which defaults to 64 million.
2024-11-20 13:46:19 -05:00
Slava Pestov
60d34a4162
Sema: Micro-optimize PotentialBindings
...
PotentialBindings is part of ConstraintGraphNode and there's no need
to store the ConstraintSystem and TypeVariableType twice.
Also it doesn't need to be optional either, because we no longer need
to reset and recompute bindings.
2024-11-20 13:35:22 -05:00
Slava Pestov
1bdf7f0192
Sema: Assert that the constraint graph node is empty before recycling
2024-11-20 13:35:22 -05:00
Slava Pestov
1a18d70f90
Sema: Remove ConstraintSystem::SolverState::isRecordingChanges()
...
All but two remaining call sites can be changed to just check for a
non-null solverState, because we want to assert if we're inside
of an active undo.
The two places inside binding inference can check isUndoActive()
directly.
2024-11-20 13:35:22 -05:00
Slava Pestov
24de22a078
Sema: Split off ConstraintGraph::addTypeVariable() from ::operator[]
...
Also, since we add a vertex immediately after introducing a new type
variable, the code path to handle the case where the type variable
had a parent or fixed type was actually dead.
2024-11-20 13:35:21 -05:00
Slava Pestov
c5de105a2b
Sema: Workaround for invalid logic in Solution::simplifyTypeForCodeCompletion()
2024-11-20 13:35:21 -05:00
Slava Pestov
6ff8f55634
Sema: Fix handling of Solution::typeBindings in replaySolution()
2024-11-20 13:35:21 -05:00
Allan Shortlidge
ec8558942c
Merge pull request #77720 from tshortli/remove-get-potentially-unavailable
...
AST: Remove `DeclAttributes::getPotentiallyUnavailable()`
2024-11-20 09:26:48 -08:00
Slava Pestov
de731b4d5d
Sema: Preserve insertion order in Solution::typeBindings
2024-11-20 11:47:07 -05:00
Pavel Yaskevich
9eaad6315c
Merge pull request #77689 from JanBaig/issue-65500
...
[CSGen] Fix compiler crash when property wrapper applied to a param lacks wrappedValue initializer
2024-11-20 08:44:49 -08:00
Pavel Yaskevich
9665b0d4e3
Merge pull request #77592 from xedin/rdar-139675914
...
[CSSimplify] CGFloat-Double: Fix ambiguity when assigning CGFloat to …
2024-11-20 08:44:19 -08:00
Slava Pestov
b760cfd03d
Sema: Fold ConstraintGraph::lookupNode() into ::operator[]
...
lookupNode() returned a pair but both callers only looked at the
first element of the pair.
2024-11-20 08:23:58 -05:00
Slava Pestov
a7b1e7854c
Merge pull request #77174 from slavapestov/fix-undo-order
...
Sema: Undo changes in chronological order in SolverTrail::undo()
2024-11-20 08:00:53 -05:00
Slava Pestov
729e3c032a
Merge pull request #77690 from slavapestov/fix-rdar139238003
...
Sema: Downgrade nonisolated lazy error to warning until -swift-version 6
2024-11-20 00:38:43 -05:00
Slava Pestov
89529af2e3
Merge pull request #77716 from slavapestov/solution-total-memory
...
Sema: Cache Solution::getTotalMemory()
2024-11-20 00:06:15 -05:00
Slava Pestov
a19c92a4e0
Sema: Extract duplication from ConstraintGraph::introduceTo/retractFromInference(Type) overloads
2024-11-19 21:24:13 -05:00
Slava Pestov
eeab483cab
Sema: Undo changes in chronological order in SolverTrail::undo()
2024-11-19 21:24:12 -05:00
Slava Pestov
1a60685292
Sema: Address the FIXME in ConstraintGraph::mergeNodes()
2024-11-19 21:24:12 -05:00
Slava Pestov
5690addb4e
Sema: Fix ordering of constraint graph updates vs fixed type assignment
2024-11-19 21:24:12 -05:00
Slava Pestov
0d3d31599f
Sema: Remove ConstraintGraph::reintroduceToInference()
2024-11-19 21:24:12 -05:00
Allan Shortlidge
b3f6421091
AST: Remove DeclAttributes::getPotentiallyUnavailable().
...
This utility duplicated logic that is now meant to be encapsulated by
`getUnsatisfiedAvailabilityConstraint()`.
2024-11-19 17:19:51 -08:00
Allan Shortlidge
6bf0e628be
AST: Rename AvailabilityContext::getDefault() to forInliningTarget().
...
Mirrors the factory methods on `AvailabilityRange`.
2024-11-19 17:19:51 -08:00
Nate Chandler
bdf662a871
[CoroutineAccessors] Default impls are transparent
...
Like every other method entry in the default witness table, the default
implementations of the `read2` and `modify2` accessors that just call
`read` and `modify` respectively should be transparent.
2024-11-19 15:52:24 -08:00
Nate Chandler
8eaae59c3b
[NFC] AST: Moved impl from Sema.
...
Now that the function is declared in AST, it should be implemented
there.
2024-11-19 15:52:24 -08:00
Pavel Yaskevich
9912c4405d
Merge pull request #77653 from xedin/revert-BindingSet-isViable-changes
...
[CSBindings] Revert changes in `BindingSet::isViable`
2024-11-19 14:22:57 -08:00
Slava Pestov
1ecba36e76
Sema: Cache Solution::getTotalMemory()
...
This is showing up in performance profiles.
2024-11-19 16:04:57 -05:00
Pavel Yaskevich
4a9d20d877
Merge pull request #77684 from xedin/switch-swiftinterface-version-to-use-Version
...
[Frontend] Switch `-interface-compiler-version` to `Version`
2024-11-19 08:56:58 -08:00
Hamish Knight
51dadb03f0
Merge pull request #77691 from hamishknight/fix-sendable-keypath-dynamic-member
...
[Completion] Fix Sendable KeyPath dynamic member subscripts
2024-11-19 09:11:30 +00:00
Meghana Gupta
5b5acc64e0
Promote Nonescapable types to a language feature
2024-11-18 18:09:17 -08:00
JanBaig
8af3aef7c4
[CSGen] Fix compiler crash when property wrapper applied to a param lacks wrappedValue initializer
2024-11-18 19:23:28 -05:00
Pavel Yaskevich
7c8000b3a5
[Frontend] Switch -interface-compiler-version to Version
...
`SWIFT_COMPILER_VERSION` has more than 4 components and it's
easier to use `Version` API over `VersionTuple` as well.
2024-11-18 15:11:36 -08:00
Slava Pestov
872f242e93
Merge pull request #77683 from slavapestov/opened-type-optzn
...
Sema: Clean up and optimize interface type opening
2024-11-18 17:40:52 -05:00
Slava Pestov
473cb0b837
Sema: Downgrade nonisolated lazy error to warning until -swift-version 6
...
Fixes rdar://139238003.
2024-11-18 17:24:58 -05:00
Hamish Knight
d877d05524
[Completion] Fix Sendable KeyPath dynamic member subscripts
...
Introduce `getKeyPathTypeForDynamicMemberLookup`
which returns the KeyPath type, and can be used
from both `RootAndResultTypeOfKeypathDynamicMemberRequest`
and `isValidKeyPathDynamicMemberLookup`. This ensures
we look to the superclass for e.g protocol compositions
with `Sendable`. This also means we now return an
interface type, which is what the client of
`RootAndResultTypeOfKeypathDynamicMemberRequest`
wanted anyway.
rdar://138418296
2024-11-18 22:22:43 +00:00
Pavel Yaskevich
26e888e45e
Merge pull request #77652 from xedin/issue-77644
...
[CSSimplify] Handle invalid type specializations
2024-11-18 10:14:14 -08:00
Slava Pestov
9a93a8a420
Sema: Fix latent bug in CSRanking.cpp
...
I believe openedType1 should be computed using innerDC1 not innerDC2.
2024-11-18 12:31:36 -05:00
Slava Pestov
06b4953b85
Sema: Remove a usage of QueryTypeSubstitutionMap
2024-11-18 11:40:39 -05:00
Slava Pestov
09df48f9fb
Sema: Remove DenseMap usage when opening types
2024-11-18 11:40:38 -05:00
Hamish Knight
4946c799af
[AST] Remove ModuleDecl::addFile
...
Rather than exposing an `addFile` member on
ModuleDecl, have the `create` members take a
lambda that populates the files for the module.
Once module construction has finished, the files
are immutable.
2024-11-17 14:17:20 +00:00
Hamish Knight
e2ba36f7f4
Factor out ModuleDecl overload of import resolution
...
This resolves imports for the entire module.
2024-11-17 14:17:20 +00:00