Commit Graph

14 Commits

Author SHA1 Message Date
Frederick Kellison-Linn
1819d33f57 Disable PlaceholderType parsing 2021-02-16 22:59:19 -05:00
Frederick Kellison-Linn
be2aeb513b [Sema] Rework DiscardAssignmentExpr checking wrt SequenceExpr folding
Now that we're checking DiscardAssignmentExprs in PreCheckExpr, we have to be careful to make sure we don't diagnose anything until after SequenceExprs have been folded, since the relevant AssignExprs won't even have a "right hand side" and "left hand side" until after folding.
2021-02-16 22:59:19 -05:00
Frederick Kellison-Linn
e4ea1678dc Rename HoleType to PlaceholderType
HoleType basically served the same purpose as PlaceholderType. This commit unifies the two.
2021-02-16 22:59:19 -05:00
Frederick Kellison-Linn
40122dfecd [Sema] Add support for folding placeholders into TypeExprs
Move markAcceptableDiscardExprs into PreCheckExpr so that we can perform this analysis before we convert expressions like `_? = <value>` into `_ = <value>` since `_?` is now an expression with meaning, and we only want to perform this transformation when `_?` is on the LHS of an assignment
2021-02-16 22:59:19 -05:00
Frederick Kellison-Linn
e508fb3733 [Sema] Introduce placeholder handler to TypeResolver
For now, don't do anything useful in clients. Specifying a placeholder type is still an error
2021-02-16 22:59:18 -05:00
Slava Pestov
01b3965459 Sema: Add a timer for preCheckExpression() 2020-12-15 23:43:04 -05:00
Pavel Yaskevich
607f49dc2e [TypeChecker] Find outermost paren or tuple while checking invalid inout use
Unwrap `InOutExpr` from all parens until the outermost paren or a tuple
to correctly diagnose calls like `foo(((&bar)))` or `foo(x: (&bar))`,
 and suggest a fix-it with moves `&` outside parens.

Resolves: rdar://problem/71356981
2020-11-19 13:31:10 -08:00
Slava Pestov
5808d9beb9 Parse: Remove parse-time name lookup 2020-11-16 22:39:44 -05:00
Slava Pestov
641a257f73 Sema: Don't diagnose forward references to debugger variables in pre-checking 2020-11-16 22:39:43 -05:00
Slava Pestov
2a678f29db Sema: Remove TypeResolutionFlags::AllowUnavailable{,Protocol} 2020-10-14 23:42:44 -04:00
Pavel Yaskevich
461eafff54 [ConstraintSystem] NFC: Move ConstraintSystem.h to include/swift/Sema 2020-10-08 10:45:47 -07:00
Slava Pestov
554e0f97e6 AST: Find local property wrappers in ASTScope::lookupLocalDecls()
Two fixes here:

- The ASTScopeDeclConsumerForLocalLookup needs to visit auxiliary variables
- preCheckExpression() should call ASTScope::lookupLocalDecls() even when
  parser lookup is enabled, since otherwise we won't be able to find
  auxiliary decls in the current DeclContext.
2020-10-02 14:40:11 -04:00
Slava Pestov
06fc9c5a5e Sema: Simulate old name lookup behavior when parser lookup is off
Before performing an UnqualifiedLookup with Flags::IncludeOuterResults
turned on, call ASTScope::lookupSingleLocalDecl() to find local
bindings that precede the current source location.

If this fails, we perform an unqualified lookup to try to find
forward references to captures, type members, and top-level
declarations.
2020-10-01 23:50:16 -04:00
Slava Pestov
d576b4e926 Sema: Move preCheckExpression() into its own file 2020-10-01 17:24:44 -04:00