Commit Graph

673 Commits

Author SHA1 Message Date
Chris Willmore
bad04371f0 Insert parentheses around expression before appending 'as T', if
necessary. Wrap forced optional fixit in parens if necessary.

<rdar://problem/20029786> Swift compiler sometimes suggests changing "as!" to "as?!"

Swift SVN r26189
2015-03-16 20:52:18 +00:00
Chris Lattner
3e3f568179 By far, the most common use of Lexer::getLocForEndOfToken is in
conjunction with .fixItInsert().  As such, introduce a helper named
.fixItInsertAfter() that does what we all want.  Adopt this in various
places around the compiler.  NFC.



Swift SVN r26147
2015-03-15 05:30:04 +00:00
Jordan Rose
f54e3570a3 Preserve the location of the 'in' when doing void-conversion on a closure.
This location is used when deciding whether a capture has already been
initialized, and without it the compiler decides that the reference to
a name from the capture list should be rejected.

rdar://problem/19776255&20153574

Swift SVN r26103
2015-03-13 17:35:14 +00:00
Devin Coughlin
749f8500d6 Sema: Emit Fix-Its for potential unavailability
We now suggest up to three Fix-Its for each reference to a potentially
unavailable symbol: one to wrap the reference in an if #os(...) { ... }
guard (if possible), one to add an @availability attribute to an enclosing
property or method (if possible), and one to add an @availability attribute
to an enclosing class/struct/extension, etc. or global function.

The goal here is not to infer the "best" Fix-It but rather to ensure
discoverability of #os() and @availability attributes. We want the user, when
faced with an availability diagnostic, to be aware of the tools in her toolbox
to deal with it.

This is still missing QoI improvements, including Fix-Its to update
existing @availability attributes and more precise wording in diagnostics
(e.g, "initializer" instead of function, "class" instead of "type"). These
improvements will come in later commits.

Swift SVN r26073
2015-03-12 23:51:11 +00:00
Chris Lattner
90920ec02f rename the IsaExpr AST node to IsExpr to follow the syntax of the language, NFC.
Swift SVN r25933
2015-03-10 17:11:37 +00:00
Jordan Rose
772a124b63 Compute captures after all bodies have been type-checked, as a separate pass.
We already have the restriction that captures can't be computed until
everything is type-checked, but previously we tried to compute captures
/immediately/ after a closure was type-checked. Unfortunately, we either
type-checked too early (before @noescape was propagated onto multi-statement
closures) or too late (trying to compute autoclosure captures at the point
the autoclosure was introduced).

Now, all closure captures are computed after type-checking, and local
function captures as well. They also more consistently reuse the capture
list of nested closures/functions. Because captures can be computed on
demand, there is now a flag on CaptureInfo for whether we've computed
captures yet. Note that some functions will never have captures computed,
namely those that are not in a local context.

rdar://problem/19956242

Swift SVN r25776
2015-03-05 02:33:37 +00:00
Joe Pamer
23458ce268 Fix constraint application on single expression closure bodies
So, it turns out that if the type checker were to re-write the Expr node of a single-expression closure body, we were never writing the modified body Expr back into the closure Expr.
This meant that if the closure expression's body were something like 'self.foo', we'd leave an UnresolvedDotExpr in the AST and most likely end up crashing down the line.

This has been responsible for about 4700 crash reports over the past several months. (Though, oddly enough, we didn't seem to hit it in the crash suite.) Thanks to Argyrios for pushing on this one!

rdar://problem/19840785

Swift SVN r25774
2015-03-05 01:57:25 +00:00
Joe Groff
5fa20867e9 SILGen: Implement thunking for C function pointer conversions.
If we have a C function pointer conversion, generate a thunk using the same logic we use for ObjC method thunks, and emit a pointer to that thunk as the C function pointer value. (This works for nongeneric, nonmember functions; generics will additionally need to apply generic parameters within the thunks. Static functions would need to gather the metatype as well.)

Swift SVN r25653
2015-03-01 06:18:58 +00:00
Devin Coughlin
b906a54fbd [Sema] Remove unnecessary check for potentially unavailable inferred type parameter actuals
This commit removes an unnecessary check that ensured that inferred type
parameter actuals are available. This check is unnecessary because the
declaration for any inferred actual type parameter (i.e., a generic type
argument at the callsite) must be referred to in an enclosing type refinement
context. If the inferred type is not available, this reference will cause a
diagnostic to be emitted, so we don't need to emit another diagnostic for the
inferred actual. Further, this diagnostic was potentially confusing because the
point at which we emitted the diagnostic did not directly mention the type
name (because it was inferred).

This commit also beefs up testing of diagnostics for potentially unavailable
type parameters.

Swift SVN r25540
2015-02-26 02:39:16 +00:00
Chris Willmore
fc561cd7ea Fix errant fixit "as!" -> "as?!"
"let x: Int? = 5 as Any as! Int" now suggests changing "as!" to "as?"
instead of "as?!".

rdar://problem/19883819

Swift SVN r25490
2015-02-23 22:59:46 +00:00
Chris Lattner
b0db122925 fix rdar://19763676 - False positive in @noescape analysis triggered by parameter label
This changes CSApply to propagate the noescape (and noreturn) bits into a closureexpr even
when the closure type is undergoing some sort of conversion, since the conversion doesn't
affect the semantics of these bits.



Swift SVN r25454
2015-02-21 01:36:19 +00:00
Doug Gregor
3805e18090 Explicitly track the mapping from dependent types to their opened type variables.
Previously, we were reconstructing this mapping from the "full" opened
type produced by declaration references. However, when dealing with
same-type constraints between associated types and type parameters, we
could end up with an incomplete mapping, which let archetypes slip
through. Most of the churn here is sorting out the locators we need to
use to find the opened-type information. Fixes rdar://problem/18208283
and at least 3 dupes of it that I've found so far.

Swift SVN r25375
2015-02-18 19:41:40 +00:00
Nadav Rotem
f5910bbe62 Fix a warning.
Swift SVN r25354
2015-02-17 18:43:17 +00:00
Chris Willmore
fdf4c035e9 Only suggest appending 'as! T' if there's a chance that the conversion would succeed.
<rdar://problem/19831919> Fixit offers as! conversions that are known to always fail

Swift SVN r25346
2015-02-17 03:42:52 +00:00
Joe Pamer
a3122ecf92 Provide a better, tailored diagnostic for result-type mismatches. (rdar://problem/19800727)
These changes include ChrisW's code review feedback.

Swift SVN r25340
2015-02-17 01:57:20 +00:00
Joe Pamer
81df1eeee0 Revert "Provide a better, tailored diagnostic for result-type mismatches. (rdar://problem/19800727)"
This reverts commit r25319.

Swift SVN r25333
2015-02-16 23:46:59 +00:00
Chris Willmore
5b51620d1d Be more tolerant of invalid protocol conformances when applying constraint solution.
* Lift NormalProtocolConformance::hasTypeWitness() to
  ProtocolConformance. This method can be used to determine whether a
  potentially invalid conformance has a particular type witness.

* ProtocolConformance::getWitness() may return nullptr if the witness
  does not exist.

* In TypeChecker::getWitnessType(), don't complain that a builtin
  protocol is broken if it's the conformance that's broken.

* ConformanceChecker should only emit diagnostics from within calls to
  checkConformance().

* TypeChecker::conformsToProtocol() now returns true if the type
  has a declared conformance to the protocol, regardless of whether the
  conformance is valid. Clients must check the validity of the
  ProtocolConformance themselves if necessary.

<rdar://problem/19495341> Can't upcast to parent types of type constraints without forcing

Swift SVN r25326
2015-02-16 22:41:52 +00:00
Joe Pamer
6e9ddbafd0 Provide a better, tailored diagnostic for result-type mismatches. (rdar://problem/19800727)
Swift SVN r25319
2015-02-16 20:00:04 +00:00
Joe Groff
94be8424ff Sema: Type checking for C function pointers.
Since a function pointer doesn't carry any context, we can only form a C function pointer from a static reference to a global function or a context-free local function or closure. (Or maybe a static function applied to its metatype, but that's not handled here yet.) As a placeholder for a to-be-bikeshedded surface syntax, let the existing @cc(cdecl) attribute appear in source text when the -enable-c-function-pointers frontend flag is passed.

Swift SVN r25308
2015-02-16 00:41:53 +00:00
Joe Pamer
d6b362ee81 Don't re-typecheck closures that have been transformed to match a void-returning contextual type. Due to their transformation, these single-expression closures will now appear as multi-expression, so a re-typecheck could potentially result in bogus type errors. (Fixes rdar://problem/19806558, which is a regression from Xcode 6.4 seed 1.)
Swift SVN r25278
2015-02-13 19:23:30 +00:00
Jordan Rose
6f87cff84e Be more consistent about requiring "self." in closures.
"self." is required whenever it causes a potentially escaping closure to
capture 'self'. This happens not just in plain ClosureExprs, but in local
functions as well. In addition, even no-escape ClosureExprs can require
self to be captured in a /parent/ closure, which may be potentially-escaping.

Swift SVN r25173
2015-02-11 07:20:29 +00:00
Chris Willmore
ee342c15c4 <rdar://problem/19770981> Swift doesn't recognize that NSString has been as! converted to String and continually suggests conversion
If appending 'as T' to an expression in a fixit, also suggest
parentheses around the resulting expression if it would otherwise be
parsed incorrectly.

Swift SVN r25168
2015-02-11 04:49:34 +00:00
Denis Vnukov
f585966027 Fix for rdar://19634354, SourceKit crashes while defining a function inside a while loop
Avoid re-typechecking of boolean literals in code completion



Swift SVN r25136
2015-02-10 21:47:47 +00:00
Jordan Rose
6fe976d3b0 Diagnose function conversions that change the function's ABI.
This post-hoc diagnostic replaces r24915, r25045, and r25054 by doing a
very basic check for representation incompatibility between two types.
More cases can be added as necessary.

rdar://problem/19600325, again.

Swift SVN r25117
2015-02-10 03:46:47 +00:00
Jordan Rose
07041fc7d3 Revert all the function type ABI restriction changes.
John pointed out that messing with the type checker's notion of "subtype"
is a bad idea. Instead, we should just have a separate check for ABI
compatibility...and eventually (rdar://problem/19517003) just insert the
appropriate thunks rather than forcing the user to perform the conversion.

I'm leaving all the tests as they are because I'm adding a post-type-checking
diagnostic in the next commit, and that should pass all the same tests.

Part of rdar://problem/19600325

Swift SVN r25116
2015-02-10 03:46:46 +00:00
Chris Willmore
af12966eb8 When fixing implicit conversion of bridged types, only insert 'as T'
instead of 'as! T' if explicit conversion is sufficient.

Refinement of fix for <rdar://problem/19551164>.

Swift SVN r25104
2015-02-10 00:29:13 +00:00
Chris Willmore
aee4c26eb0 Fix indentation of fix cases in ConstraintSystem::applySolution().
Swift SVN r25062
2015-02-07 00:37:10 +00:00
Chris Willmore
e2ac9f65ac Add FixKind for 'as' -> 'as!' conversion
Penalize solutions that involve 'as' -> 'as!' changes by recording a Fix
when simplifying the corresponding checked-cast constraint.

<rdar://problem/19724719> Type checker thinks "(optionalNSString ?? nonoptionalNSString) as String" is a forced cast

Swift SVN r25061
2015-02-07 00:33:37 +00:00
Jordan Rose
19af8a124c Re-apply "If a function conversion fails, suggest wrapping in a closure."
This re-applies r24987, reverted in r24990, with a fix for a spuriously-
introduced error: don't use a favored constraint in a disjunction to avoid
applying a fix. (Why not? Because favoring bubbles up, i.e. the
/disjunction/ becomes favored even if the particular branch is eventually
rejected.) This doesn't seem to affect the outcome, though: the other
branch of the disjunction doesn't seem to be tried anyway.

Finishes rdar://problem/19600325

Swift SVN r25054
2015-02-06 23:12:54 +00:00
Jordan Rose
18355ca44a Revert "If a function conversion fails, suggest wrapping in a closure."
This reverts commit r24987. The constraint system is choosing the fix
case over the normal case in Dollar.swift.

Swift SVN r24990
2015-02-05 03:56:20 +00:00
Jordan Rose
ad7440989b If a function conversion fails, suggest wrapping in a closure.
And even if we don't suggest wrapping in a closure (say, because there's
already a closure involved), emit a more relevant diagnostic anyway.
(Wordsmithing welcome.)

Wrapping a function value in a closure essentially explicitly inserts a
conversion thunk that we should eventually be able to implicitly insert;
that's rdar://problem/19517003.

Part of rdar://problem/19600325

Swift SVN r24987
2015-02-05 01:56:47 +00:00
Doug Gregor
6a1b7348e0 Make trailing closure syntax match the last parameter, always.
Previously, trailing closures would try to match the first parameter
of (possibly optional) function type that didn't seem to have an
argument already, but in practice this broke when there were
parameters with default arguments before the function parameter.

The new rule is far simpler: a trailing closure matches the last
parameter. Fixes rdar://problem/17965209.

Swift SVN r24898
2015-02-02 19:47:31 +00:00
Chris Willmore
ab86515fb2 <rdar://problem/19671476> Offer as -> as! changes in all nested contexts
When generating constraints for an 'as' expression, consider the
possibility that the code is supposed to be 'as!' instead of 'as'. Emit
the appropriate fixit if that branch of the disjunction is chosen by the
constraint solver.

This is a more comprehensive fix for <rdar://problem/19499340> than the
one in r24815.

Swift SVN r24872
2015-01-31 00:55:53 +00:00
Joe Pamer
666646fee9 Fix "the world's shortest Swift crasher" (case 1083), as described this afternoon on Twitter by @PracticalSwift. Doing so has the nice side effect of addressing several other crashers.
Swift SVN r24857
2015-01-30 21:50:22 +00:00
Devin Coughlin
00ccdbc6c1 Sema: Move potential unavailability diagnostics into MiscDiagnostics.
This commit moves potential unavailability diagnostics (when not treating unavailable
symbols as optional) out of CSApply.cpp and into MiscDiagnostics.cpp, alongside the
deprecation-based and explicitly unavailable checks. This move is a precursor to adding
support for separate availability information on getters and setters. No intended
functional change.

Swift SVN r24836
2015-01-30 00:25:27 +00:00
Joe Pamer
6a70bd085e These changes implement some oft-requested tweaks and fixes to our closure implementation:
- Closures that are comprised of only a single return statement are now considered to be "single expression" closures. (rdar://problem/17550847)
- Unannotated single expression closures with non-void return types can now be used in void contexts. (rdar://problem/17228969)
- Situations where a multi-statement closure's type could not be inferred because of the lack of a return-type annotation are now properly diagnosed. (rdar://problem/17212107)

I also encountered a number of crashers along the way, which should now be fixed.

Swift SVN r24817
2015-01-29 18:48:39 +00:00
Joe Pamer
d2c2add5de Introduce a hack for ensuring that, in the face of unresolved member exprs, call argument types line up nicely with the associated argument tuple type. (rdar://problem/18841652, rdar://problem/18913150, etc.)
This was one of our most visible user-facing crashers, manifesting itself any time a user performed an equality comparison on an unresolved enum case.

Swift SVN r24753
2015-01-27 20:56:03 +00:00
Chris Willmore
32438add4a <rdar://problem/19495253> Incorrect diagnostic for explicitly casting to the same type
Change "downcast" to "cast" in warnings where downcast isn't actually
downcast.

Swift SVN r24704
2015-01-24 01:28:55 +00:00
Graham Batty
057c27f009 Disable existential metatype casting on non-objc.
Also fixes getting the size of an instance of a class to
work without it when objective-c interop is turned off.

Swift SVN r24477
2015-01-16 20:27:54 +00:00
John McCall
6a46350546 Bugfixes for the new addressor kinds.
Permit non-Ordinary accesses on references to functions,
with the semantics of devirtualizing the call if the
function is a class member.  This is important for
constructing direct call to addressors from synthesized
materializeForSet accessors: for one, it's more
performant, and for another, addressors do not currently
appear in v-tables.

Synthesize trivial accessors for addressed class members.
We weren't doing this at all before, and I'm still not
sure we're doing it right in all cases.  This is a mess.

Assorted other fixes.  The new addressor kinds seem
to work now.

Swift SVN r24393
2015-01-13 10:37:22 +00:00
Chris Willmore
03a6190a1f <rdar://problem/19031957> Change failable casts from "as" to "as!"
Previously the "as" keyword could either represent coercion or or forced
downcasting. This change separates the two notions. "as" now only means
type conversion, while the new "as!" operator is used to perform forced
downcasting. If a program uses "as" where "as!" is called for, we emit a
diagnostic and fixit.

Internally, this change removes the UnresolvedCheckedCastExpr class, in
favor of directly instantiating CoerceExpr when parsing the "as"
operator, and ForcedCheckedCastExpr when parsing the "as!" operator.

Swift SVN r24253
2015-01-08 00:33:59 +00:00
Chris Lattner
1486238412 Reapply:
propagate the no-escape bit from a parameter into a closure-expr argument.  When a 
ClosureExpr is thus inferred to be non-escape, disable the "self." requirement.

.. with fixes.  Thanks again to Dmitri for reverting + adding testcase.



Swift SVN r24115
2014-12-23 18:21:14 +00:00
Dmitri Hrybenko
7ef8a95f8c Revert "propagate the no-capture bit from a parameter into a
closure-expr argument.  When a "

This reverts commit r24085.  It causes crashes in the validation
testsuite even with r24094.  Testcase:

    var x = { f: Int {} }

Swift SVN r24102
2014-12-23 04:06:15 +00:00
Chris Lattner
410c3ef431 propagate the no-capture bit from a parameter into a closure-expr argument. When a
ClosureExpr is thus inferred to be non-captured, disable the "self." requirement.


Swift SVN r24085
2014-12-22 23:58:39 +00:00
Chris Lattner
4345fce329 random tidying, NFC.
Swift SVN r24082
2014-12-22 22:51:09 +00:00
Joe Pamer
2912159776 Improve diagnostics for expression typecheck errors
These changes make the following improvements to how we generate diagnostics for expression typecheck failure:
- Customizing a diagnostic for a specific expression kind is as easy as adding a new method to the FailureDiagnosis class,
  and does not require intimate knowledge of the constraint solver’s inner workings.
    - As part of this patch, I’ve introduced specialized diagnostics for call, binop, unop, subscript, assignment and inout
      expressions, but we can go pretty far with this.
    - This also opens up the possibility to customize diagnostics not just for the expression kind, but for the specific types
      involved as well.
- For the purpose of presenting accurate type info, partially-specialized subexpressions are individually re-typechecked
  free of any contextual types. This allows us to:
    - Properly surface subexpression errors.
    - Almost completely avoid any type variables in our diagnostics. In cases where they could not be eliminated, we now
      substitute in "_".
    - More accurately indicate the sources of errors.
- We do a much better job of diagnosing disjunction failures. (So no more nonsensical ‘UInt8’ error messages.)
- We now present reasonable error messages for overload resolution failures, informing the user of partially-matching
  parameter lists when possible.

At the very least, these changes address the following bugs:

<rdar://problem/15863738> More information needed in type-checking error messages
<rdar://problem/16306600> QoI: passing a 'let' value as an inout results in an unfriendly diagnostic
<rdar://problem/16449805> Wrong error for struct-to-protocol downcast
<rdar://problem/16699932> improve type checker diagnostic when passing Double to function taking a Float
<rdar://problem/16707914> fatal error: Can't unwrap Optional.None…Optional.swift, line 75 running Master-Detail Swift app built from template
<rdar://problem/16785829> Inout parameter fixit
<rdar://problem/16900438> We shouldn't leak the internal type placeholder
<rdar://problem/16909379> confusing type check diagnostics
<rdar://problem/16951521> Extra arguments to functions result in an unhelpful error
<rdar://problem/16971025> Two Terrible Diagnostics
<rdar://problem/17007804> $T2 in compiler error string
<rdar://problem/17027483> Terrible diagnostic
<rdar://problem/17083239> Mysterious error using find() with Foundation types
<rdar://problem/17149771> Diagnostic for closure with no inferred return value leaks type variables
<rdar://problem/17212371> Swift poorly-worded error message when overload resolution fails on return type
<rdar://problem/17236976> QoI: Swift error for incorrectly typed parameter is confusing/misleading
<rdar://problem/17304200> Wrong error for non-self-conforming protocols
<rdar://problem/17321369> better error message for inout protocols
<rdar://problem/17539380> Swift error seems wrong
<rdar://problem/17559593> Bogus locationless "treating a forced downcast to 'NSData' as optional will never produce 'nil'" warning
<rdar://problem/17567973> 32-bit error message is really far from the mark: error: missing argument for parameter 'withFont' in call
<rdar://problem/17671058> Wrong error message: "Missing argument for parameter 'completion' in call"
<rdar://problem/17704609> Float is not convertible to UInt8
<rdar://problem/17705424> Poor error reporting for passing Doubles to NSColor: extra argument 'red' in call
<rdar://problem/17743603> Swift compiler gives misleading error message in "NSLayoutConstraint.constraintsWithVisualFormat("x", options: 123, metrics: nil, views: views)"
<rdar://problem/17784167> application of operator to generic type results in odd diagnostic
<rdar://problem/17801696> Awful diagnostic trying to construct an Int when .Int is around
<rdar://problem/17863882> cannot convert the expression's type '()' to type 'Seq'
<rdar://problem/17865869> "has different argument names" diagnostic when parameter defaulted-ness differs
<rdar://problem/17937593> Unclear error message for empty array literal without type context
<rdar://problem/17943023> QoI: compiler displays wrong error when a float is provided to a Int16 parameter in init method
<rdar://problem/17951148> Improve error messages for expressions inside if statements by pre-evaluating outside the 'if'
<rdar://problem/18057815> Unhelpful Swift error message
<rdar://problem/18077468> Incorrect argument label for insertSubview(...)
<rdar://problem/18079213> 'T1' is not identical to 'T2' lacks directionality
<rdar://problem/18086470> Confusing Swift error message: error: 'T' is not convertible to 'MirrorDisposition'
<rdar://problem/18098995> QoI: Unhelpful compiler error when leaving off an & on an inout parameter
<rdar://problem/18104379> Terrible error message
<rdar://problem/18121897> unexpected low-level error on assignment to immutable value through array writeback
<rdar://problem/18123596> unexpected error on self. capture inside class method
<rdar://problem/18152074> QoI: Improve diagnostic for type mismatch in dictionary subscripting
<rdar://problem/18242160> There could be a better error message when using [] instead of [:]
<rdar://problem/18242812> 6A1021a : Type variable leaked
<rdar://problem/18331819> Unclear error message when trying to set an element of an array constant (Swift)
<rdar://problem/18414834> Bad diagnostics example
<rdar://problem/18422468> Calculation of constant value yields unexplainable error
<rdar://problem/18427217> Misleading error message makes debugging difficult
<rdar://problem/18439742> Misleading error: "cannot invoke" mentions completely unrelated types as arguments
<rdar://problem/18535804> Wrong compiler error from swift compiler
<rdar://problem/18567914> Xcode 6.1. GM, Swift, assignment from Int64 to NSNumber. Warning shown as problem with UInt8
<rdar://problem/18784027> Negating Int? Yields Float
<rdar://problem/17691565> attempt to modify a 'let' variable with ++ results in typecheck error about @lvalue Float
<rdar://problem/17164001> "++" on let value could give a better error message

Swift SVN r23782
2014-12-08 21:56:47 +00:00
Chris Lattner
f3ed7e93e1 Completely redesign our AST representation of capturelists. Formerly,
a capture list hung off the CaptureExpr it was associated with.  This made
sense lexically (since a capture list is nested inside of the closure) but
not semantically.  Semantically, the capture list initializers are evaluated
outside the closure, the variables are bound to those values, then the closure
captures the newly bound values.

To directly represent this, represent captures with a new CaptureListExpr node,
which contains the ClosureExpr inside of it.  This correctly models the semantic
relationship, and makes sure that AST walkers all process the initializers of the
capture list as being *outside* of the closure.

This fixes rdar://19146761 and probably others.


Swift SVN r23756
2014-12-06 04:36:11 +00:00
Chris Willmore
36d0f187ec Sema, SILGen, ClangImporter: Add special support for Set<T>
Add the following functionality to the Swift compiler:

* covariant subtyping of Set
* upcasting, downcasting of Set
* automatic bridging between Set and NSSet, including
    * NSSet params/return values in ObjC are imported as Set<NSObject>
    * Set params/return values in Swift are visible to ObjC as NSSet

<rdar://problem/18853078> Implement Set<T> up and downcasting

Swift SVN r23751
2014-12-06 02:52:33 +00:00
Jordan Rose
f0582e27b9 Testing whether a type is bridged to ObjC isn't always a public use.
Push the "in expression" flag up through TypeChecker::getBridgedToObjC and
TypeChecker::getDynamicBridgedThroughObjCClass.

Swift SVN r23701
2014-12-05 00:23:29 +00:00
Jordan Rose
2b0fbcbe80 Looking up conformances for a type isn't always a public use of the type.
Specifically, it's not when
- the conformance is being used within a function body (test included)
- the conformance is being used for or within a private type (test included)
- the conformance is being used to generate a diagnostic string

We're still a bit imprecise in some places (checking ObjC bridging), but
in general this means less of an issue for checking literals.

Swift SVN r23700
2014-12-05 00:23:24 +00:00