We were getting this wrong for properties introduced in class extensions, for which we currently do not emit vtable entries and so are statically dispatched. Fixes <rdar://problem/17577579>. This also incidentally fixes references to properties of generic classes, which should be dynamically dispatched, but weren't because of getDeclaredTypeOf/InContext confusion.
Swift SVN r19641
We need to be able to ask whether a method requires dynamic dispatch in other places in SILGen. NFC yet, but a step on the way to fixing <rdar://problem/17577579>.
Swift SVN r19636
- Change the parser to accept "objc" without an @ sign as a contextual
keyword, including the dance to handle the general parenthesized case.
- Update all comments to refer to "objc" instead of "@objc".
- Update all diagnostics accordingly.
- Update all tests that fail due to the diagnostics change.
- Switch the stdlib to use the new syntax.
This does not switch all tests to use the new syntax, nor does it warn about
the old syntax yet. That will be forthcoming. Also, this needs a bit of
refactoring, which will be coming up.
Swift SVN r19555
SILGen lowers this to unchecked_trivial_bit_cast or unchecked_ref_bit_cast based on the semantics of the input and output types, raising an unsupported error if one of the types are address-only.
Swift SVN r19058
Tweak the AST representation and type-checking of default arguments to preserve a full ConcreteDeclRef with substitutions to the owner of the default arguments. In SILGen, emit default argument generators with the same genericity as the original function.
Swift SVN r18760
This makes imported factory initializers (barely) usable from
Swift-defined convenience initializers, which is needed for
<rdar://problem/16509024>.
This is all an egregious hack, because factory initializers should
really be expressible in Swift and should only emit allocating
constructors. Doing this correctly is tracked by <rdar://problem/16884348>.
Swift SVN r17946
This looks like this may always be initialized, but the logic is
a bit harder to follow and this simple extra checking doesn't
really cost us.
Swift SVN r17615
When we partially apply an inner-pointer method or property, the thunk or partial_apply that applies "self" needs to be the one that handles lifetime-extending "self". Verify that a partial_apply-ed inner pointer method is not inner pointer and implement lifetime extension in the partial apply thunk. Fixes <rdar://problem/16803701>.
Swift SVN r17321
There were a bunch of things broken here--it's amazing this ever appeared to work.
- Retain 'self' before partial_applying it to the method, so we don't overrelease it.
- Correctly lower the ownership conventions of the dynamic method against the SILDeclRef, so we don't overrelease arguments or over-over-release self, and we handle ObjC methods with weird conventions correctly.
- Thunk when there are bridging type differences between the partially-applied ObjC method and a Swift method, so we don't crash if the method takes NSStrings or other bridged types.
Add verifier checks that the result of 'dynamic_method' and BB arg of 'dynamic_method_br' actually match the method they're dispatching.
Swift SVN r17198
a net +1 to being a net -1.
I'm pretty sure I just copy-and-pasted this and then
forgot to actually implement it. Oops. In my defense,
I was planning to actually audit/test correctness when
I actually started doing CF management.
Swift SVN r16924
- Change the parser to unconditionally reject @mutating and @!mutating with a fixit and
specific diagnostic to rewrite them into the [non]mutating keyword.
- Update tests.
This resolves <rdar://problem/16735619> introduce nonmutating CS keyword and remove the attribute form of mutating all together
Swift SVN r16892
An unsafe cast from a base to a derived class isn't really all that different from one from Builtin.NativeObject to an arbitrary class, so relax this pair of instructions to allow an arbitrary bitcast. This only combines the instructions; it doesn't attempt to simplify any codegen that was emitting round-trip casts before yet.
Swift SVN r16736
Do this the lazy way, just autoreleasing "self" after the call. A future optimization pass may be able to eliminate this autorelease when it recognizes the lifetime of the derived value, but that's not immediately necessary.
Swift SVN r16635
This will represent the return convention of imported __attribute__((objc_returns_inner_pointer)) methods. Leave it unimplemented for now until we can autorelease things sanely.
Swift SVN r16628
Introduce CtorInitializerKind to describe the kind of an enum, rather
than a bool, to make way for more initializer kinds in the future.
Swift SVN r16525
This means that we now synthesize getters and setters a lot more than we used to, so the
implementation work on this shook out a ton of bugs with them.
There is still one failure that I don't understand at all (test/stdlib/NewArray.swift.gyb),
nor do I understand how to diagnose the problem, so I XFAILed it and filed rdar://16604980 to
track fixing it.
Swift SVN r16299
These bits are orthogonal to each other, so combine them into one, and diagnose attempts to produce a type that's both. Spot-fix a bunch of places this revealed by inspection that we would have crashed in SILGen or IRGen if blocks were be handled.
Swift SVN r16088
This is missing almost all semantic analysis and is missing various
optimization opportunities (e.g. final methods that are not overrides
don't need vtable entries), but this is enough to devirtualize class
stuff, which is important for our performance efforts. I'll add this
to release notes when it is more fully fleshed out.
Swift SVN r15885
Lower LValueConversionExprs to LValueConversionComponents of SILGen's LValues, which add the conversion pair as a logical component of a writeback chain.
Swift SVN r15771
Language features like erasing concrete metatype
values are also left for the future. Still, baby steps.
The singleton ordinary metatype for existential types
is still potentially useful; we allow it to be written
as P.Protocol.
I've been somewhat cavalier in making code accept
AnyMetatypeType instead of a more specific type, and
it's likely that a number of these places can and
should be more restrictive.
When T is an existential type, parse T.Type as an
ExistentialMetatypeType instead of a MetatypeType.
An existential metatype is the formal type
\exists t:P . (t.Type)
whereas the ordinary metatype is the formal type
(\exists t:P . t).Type
which is singleton. Our inability to express that
difference was leading to an ever-increasing cascade
of hacks where information is shadily passed behind
the scenes in order to make various operations with
static members of protocols work correctly.
This patch takes the first step towards fixing that
by splitting out existential metatypes and giving
them a pointer representation. Eventually, we will
need them to be able to carry protocol witness tables
Swift SVN r15716
Optional type,
The attempt to coerce the operand to UncheckedOptional for
dynamic member accesses leads to an inconsistency when
applying the constraint solution because we haven't figured
out how to convert to UncheckedOptional<T> --- all the
conversion restrictions are to optional type.
The test case will be part of the standard test suite when
applying the UncheckedOptional import patch.
In order to continue to work around weaknesses in SILGen's
function conversion code, peephole optional conversion in
the function application path.
Swift SVN r15651
We won't have any types where copying has an effect on the bit pattern (except for blocks, which need special handling anyway), and copy_value having a result makes optimizations more complex, so remove it.
Swift SVN r15640
We can just get it from the instance type, if the instance type has been fully initialized, which is the case except during parsing of type decls when the decls' own types are being formed.
Swift SVN r15598
Getters and setters don't always take self at +1, in particular @objc accessors, so we can't just take the base object as an unmanaged thing. Fixes <rdar://problem/16398756>.
Swift SVN r15372
This switches property/subscript dispatch to use virtual dispatch instead of static
dispatch. This currently only works for computed properties (and subscripts of
course), not stored ones yet.
Long story short, this:
class Base {
subscript() -> Int {
return 42
}
}
class Derived : Base {
@override
subscript() -> Int {
return 9
}
}
var a : Base = Derived()
print(a[])
now prints 9 instead of 42.
Swift SVN r15142
Loosen the restrictions on open_existential_ref to also allow it to
refer to an existential metatype. When it does, open_existential_ref
returns the metatype for the opened archetype.
Swift SVN r15113