From 7fb4d948893db3332fcb7610261300cc5b856cff Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 8 Jan 2016 18:06:06 +0100 Subject: rewrite propagation of extension functions to subclasses to handle shadowing and applicability more correctly --- .../format/inapplicableExtensionFunctions.kt | 11 +++++++++++ .../format/inapplicableExtensionFunctions.md | 20 ++++++++++++++++++++ core/testdata/format/shadowedExtensionFunctions.kt | 18 ++++++++++++++++++ core/testdata/format/shadowedExtensionFunctions.md | 22 ++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 core/testdata/format/inapplicableExtensionFunctions.kt create mode 100644 core/testdata/format/inapplicableExtensionFunctions.md create mode 100644 core/testdata/format/shadowedExtensionFunctions.kt create mode 100644 core/testdata/format/shadowedExtensionFunctions.md (limited to 'core/testdata') diff --git a/core/testdata/format/inapplicableExtensionFunctions.kt b/core/testdata/format/inapplicableExtensionFunctions.kt new file mode 100644 index 00000000..d2c65b46 --- /dev/null +++ b/core/testdata/format/inapplicableExtensionFunctions.kt @@ -0,0 +1,11 @@ +open class Foo { +} + +class Bar : Foo() { +} + +fun Foo.shazam() { +} + +fun Bar.xyzzy() { +} diff --git a/core/testdata/format/inapplicableExtensionFunctions.md b/core/testdata/format/inapplicableExtensionFunctions.md new file mode 100644 index 00000000..8460cf2f --- /dev/null +++ b/core/testdata/format/inapplicableExtensionFunctions.md @@ -0,0 +1,20 @@ +[test](test/index) / [Bar](test/-bar/index) + + +# Bar + +`class Bar : [Foo](test/-foo/index)<Char>` + + + +### Constructors + + +| [<init>](test/-bar/-init-) | `Bar()` | + + +### Extension Functions + + +| [xyzzy](test/xyzzy) | `fun [Bar](test/-bar/index).xyzzy(): Unit` | + diff --git a/core/testdata/format/shadowedExtensionFunctions.kt b/core/testdata/format/shadowedExtensionFunctions.kt new file mode 100644 index 00000000..64df1ecb --- /dev/null +++ b/core/testdata/format/shadowedExtensionFunctions.kt @@ -0,0 +1,18 @@ +open class Foo { +} + +class Bar : Foo() { +} + +fun Foo.xyzzy() { +} + +fun Foo.shazam() { + +} + +fun Bar.xyzzy() { +} + +fun Bar.shazam(i: Int) { +} diff --git a/core/testdata/format/shadowedExtensionFunctions.md b/core/testdata/format/shadowedExtensionFunctions.md new file mode 100644 index 00000000..5218d299 --- /dev/null +++ b/core/testdata/format/shadowedExtensionFunctions.md @@ -0,0 +1,22 @@ +[test](test/index) / [Bar](test/-bar/index) + + +# Bar + +`class Bar : [Foo](test/-foo/index)` + + + +### Constructors + + +| [<init>](test/-bar/-init-) | `Bar()` | + + +### Extension Functions + + +| [shazam](test/shazam) | `fun [Bar](test/-bar/index).shazam(i: Int): Unit` +`fun [Foo](test/-foo/index).shazam(): Unit` | +| [xyzzy](test/xyzzy) | `fun [Bar](test/-bar/index).xyzzy(): Unit` | + -- cgit