Commit Graph

3 Commits

Author SHA1 Message Date
Slava Pestov
c543838854 Sema: Rewrite partial applications into closures
When a method is called with fewer than two parameter lists,
transform it into a fully-applied call by wrapping it in a
closure.

Eg,

Foo.bar => { self in { args... self.bar(args...) } }
foo.bar => { self in { args... self.bar(args...) } }(self)

super.bar => { args... in super.bar(args...) }

With this change, SILGen only ever sees fully-applied calls,
which will allow ripping out some code.

This new way of doing curry thunks fixes a long-standing bug
where unbound references to protocol methods did not work.

This is because such a reference must open the existential
*inside* the closure, after 'self' has been applied, whereas
the old SILGen implementation of curry thunks really wanted
the type of the method reference to match the opened type of
the method.

A follow-up cleanup will remove the SILGen curry thunk
implementation.

Fixes rdar://21289579 and https://bugs.swift.org/browse/SR-75.
2020-03-18 09:29:22 -04:00
Slava Pestov
45330816b4 Profile: Run tests through to -emit-ir to get better coverage 2020-03-17 19:03:03 -04:00
Vedant Kumar
c3f4d99e57 Group the the code coverage, profiling, and pgo tests together (#16070)
* Group tests for profiling instrumentation together, NFC

This will make it easier to test changes to the code coverage logic.

There are a handful of tests which relate to profiling which I have not
moved. These include tests for the driver and for the SIL optimizer. It
makes more sense to keep those tests where they are.

* Rename a test file, NFC

This file tests code coverage of primary files, so I've changed the name
of the file to reflect that.

* Simplify the check lines in a test, NFC

This file tests code coverage of closures. It had several check lines
which obscured the meaning of the test, and its check lines were in a
strange order.

Remove the extra checks and disable -emit-sorted-sil.
2018-04-20 15:15:52 -07:00