Commit Graph

14 Commits

Author SHA1 Message Date
Slava Pestov
7f3c97bf8b AST: More consistent spelling of 'type alias' in diagnostics
Some messages said 'typealias' and others said 'type alias'.
Change everything to use 'type alias' consistently (except
when it's talking about the keyword itself).
2017-04-23 00:02:30 -07:00
Doug Gregor
c522bb5239 [GSB] Separate out "unresolved" and "direct" type requirement handling.
As we've done with layout requirements, introduce a new entry point
(addTypeRequirement) that handles unresolved type requirements of the
form `T: U`, resolves the types, and then can

1. Diagnose any immediate problems with the types,
2. Delay the type requirement if one of the types cannot be resolved,
or
3. Break it into one or more "direct" requirements.

This allows us to clean up and centralize a bunch of checking that was
scattered/duplicated across the GSB and type checker.
2017-04-07 16:53:11 -07:00
Doug Gregor
44c2f849d6 [Type checker] Continue validating requirements after an error.
We want to validate both type in same-type or conformance constraints,
even when the first type is ill-formed, so we don't leave null types
around for later phases to crash on.

Fixes rdar://problem/31093854.
2017-04-05 14:05:59 -07:00
Doug Gregor
ab7cd7fbe4 Enable associated type where clauses in all language modes
We're ready to start experimenting with and rolling out this feature
in earnest.
2017-04-04 10:58:01 -07:00
Huon Wilson
54f247693c [AST]/[Parse] parse where clauses on protocol declarations. 2017-03-09 16:08:16 -08:00
Huon Wilson
8423018057 [Parse] Parse trailing where clauses on associated types. 2017-02-24 19:21:32 -08:00
Slava Pestov
b9a4f4af03 ArchetypeBuilder: Drop requirements containing concrete types with unresolved associated types
When building a generic signature, we would drop requirements
where the LHS or RHS was a DependentMemberType with an unresolved
associated type, however we didn't perform the same check for
DependentMemberTypes that are nested inside structural types.
2016-12-19 18:49:57 -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
Slava Pestov
a760186505 AST: Remove -enable-experimental-nested-generic-types flag 2016-11-18 00:39:15 -08:00
Joe
3938d5682a [SE-0095] [Runtime], [Demangler], & AST printer updated to new composition syntax
- All parts of the compiler now use ‘P1 & P2’ syntax
- The demangler and AST printer wrap the composition in parens if it is
in a metatype lookup
- IRGen mangles compositions differently
    - “protocol<>” is now “swift.Any”
    - “protocol<_TP1P,_TP1Q>” is now “_TP1P&_TP1Q”
- Tests cases are updated and added to test the new syntax and mangling
2016-07-19 12:01:37 -07:00
Joe
a6dad0091b [SE-0095] Initial parsing implementation for '&' composition syntax
This commit defines the ‘Any’ keyword, implements parsing for composing
types with an infix ‘&’, and provides a fixit to convert ‘protocol<>’

- Updated tests & stdlib for new composition syntax
- Provide errors when compositions used in inheritance.
Any is treated as a contextual keyword. The name ‘Any’
is used emit the empty composition type. We have to
stop user declaring top level types spelled ‘Any’ too.
2016-07-19 12:01:02 -07:00
Slava Pestov
612991e903 Add two test cases with an unclear diagnostics 2016-06-23 00:01:39 -07:00
Slava Pestov
3a043a25e1 Sema: Hacky fix for a crash in CSDiag
It looks like the mapTypeIntoContext() call is using the wrong
'dc', because in fact we have no way of knowing what the original
'dc' was which produced the type parameters in question.

Really the problem is we're picking apart SubstitutedType here,
which is almost always the wrong thing to do. I don't think
SubstitutedType should exist at all.

To avoid the crash, just bail-out if 'dc' is not generic.

I'm intentionally avoiding a principled fix here to hasten the
apocalypse when all of CSDiag.cpp will collapse under its own
weight and get rewritten in a sane way.
2016-06-21 16:25:29 -07:00
Slava Pestov
5b4ee41772 Parser: Diagnose if free-standing 'where' clause is attached to a non-generic declaration
Previously we would produce an empty GenericParamList, crashing Sema.
2016-06-18 17:15:25 -07:00