-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(swift) correctly highlight generics and conformances in type defi…
…nitions (#3937) * Add tests for generic class * Only type declaration is `title.class` * Add newline tests for class definition * Add additional tests for type definition * Add superclass and inheritance tests for classes * Inheritances use `title.class.inherited` * Add more test cases * Test nested classes
- Loading branch information
1 parent
a66c24f
commit 518a820
Showing
7 changed files
with
148 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,61 @@ | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">TestClass</span> {} | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">TestClass</span>: <span class="hljs-title class_ inherited__">Superclass</span> {} | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">TestClass</span>: <span class="hljs-title class_ inherited__">Superclass</span>, <span class="hljs-title class_ inherited__">Conform1</span>, <span class="hljs-title class_ inherited__">Conform2</span> {} | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">TestClass</span><<span class="hljs-type">T</span>> {} | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">TestClass</span><<span class="hljs-type">T</span>, <span class="hljs-type">U</span>> {} | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">TestClass</span><<span class="hljs-keyword">repeat</span> <span class="hljs-keyword">each</span> <span class="hljs-type">T</span>> {} | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">TestClass</span><<span class="hljs-type">T</span>> <span class="hljs-keyword">where</span> <span class="hljs-type">T</span>: <span class="hljs-type">Equatable</span> {} | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">TestClass</span><<span class="hljs-type">T</span>>: <span class="hljs-title class_ inherited__">Superclass</span> <span class="hljs-keyword">where</span> <span class="hljs-title class_ inherited__">T</span>: <span class="hljs-title class_ inherited__">Equatable</span> {} | ||
|
||
<span class="hljs-keyword">class</span> | ||
<span class="hljs-title class_">MoreThanOneLine</span> | ||
{} | ||
|
||
<span class="hljs-keyword">class</span> | ||
<span class="hljs-title class_">MoreThanOneLineInherit</span> | ||
: | ||
<span class="hljs-title class_ inherited__">Superclass</span> | ||
{} | ||
|
||
<span class="hljs-keyword">class</span> | ||
<span class="hljs-title class_">MoreThanOneLineInherit</span> | ||
: | ||
<span class="hljs-title class_ inherited__">Superclass1</span>, | ||
<span class="hljs-title class_ inherited__">Superclass2</span> | ||
{} | ||
|
||
<span class="hljs-keyword">class</span> | ||
<span class="hljs-title class_">MoreThanOneLineInherit</span>: | ||
<span class="hljs-title class_ inherited__">Superclass</span> | ||
{} | ||
|
||
<span class="hljs-keyword">final</span> <span class="hljs-keyword">class</span> | ||
<span class="hljs-title class_">MoreThanOneLineGeneric</span><<span class="hljs-type">T</span>> | ||
<span class="hljs-keyword">where</span> | ||
<span class="hljs-type">T</span>: <span class="hljs-type">Param</span> | ||
{} | ||
|
||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">Outer</span> { | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">Inner</span><<span class="hljs-type">T</span>> {} | ||
<span class="hljs-keyword">class</span> <span class="hljs-title class_">InnerInherit</span>: <span class="hljs-title class_ inherited__">Superclass</span> {} | ||
} | ||
|
||
<span class="hljs-keyword">struct</span> <span class="hljs-title class_">TestStruct</span> {} | ||
<span class="hljs-keyword">struct</span> <span class="hljs-title class_">TestStruct</span>: <span class="hljs-title class_ inherited__">Conform</span> {} | ||
<span class="hljs-keyword">struct</span> <span class="hljs-title class_">TestStruct</span><<span class="hljs-type">T</span>, <span class="hljs-type">U</span>> {} | ||
|
||
<span class="hljs-keyword">enum</span> <span class="hljs-title class_">TestEnum</span> {} | ||
<span class="hljs-keyword">enum</span> <span class="hljs-title class_">TestEnum</span>: <span class="hljs-title class_ inherited__">Conform</span> {} | ||
<span class="hljs-keyword">enum</span> <span class="hljs-title class_">TestEnum</span><<span class="hljs-type">T</span>, <span class="hljs-type">U</span>> {} | ||
|
||
<span class="hljs-keyword">actor</span> <span class="hljs-title class_">TestActor</span> {} | ||
<span class="hljs-keyword">actor</span> <span class="hljs-title class_">TestActor</span>: <span class="hljs-title class_ inherited__">Conform</span> {} | ||
<span class="hljs-keyword">actor</span> <span class="hljs-title class_">TestActor</span><<span class="hljs-type">T</span>, <span class="hljs-type">U</span>> {} | ||
|
||
<span class="hljs-keyword">extension</span> <span class="hljs-title class_">TestExtension</span> {} | ||
<span class="hljs-keyword">extension</span> <span class="hljs-title class_">TestExtension</span>: <span class="hljs-title class_ inherited__">Conform</span> {} | ||
<span class="hljs-keyword">extension</span> <span class="hljs-title class_">TestExtension</span><<span class="hljs-type">T</span>, <span class="hljs-type">U</span>> {} | ||
|
||
<span class="hljs-keyword">protocol</span> <span class="hljs-title class_">TestProtocol</span> {} | ||
<span class="hljs-keyword">protocol</span> <span class="hljs-title class_">TestProtocol</span>: <span class="hljs-title class_ inherited__">Conform</span> {} | ||
<span class="hljs-keyword">protocol</span> <span class="hljs-title class_">TestProtocol</span><<span class="hljs-type">T</span>, <span class="hljs-type">U</span>> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,61 @@ | ||
class TestClass {} | ||
class TestClass: Superclass {} | ||
class TestClass: Superclass, Conform1, Conform2 {} | ||
class TestClass<T> {} | ||
class TestClass<T, U> {} | ||
class TestClass<repeat each T> {} | ||
class TestClass<T> where T: Equatable {} | ||
class TestClass<T>: Superclass where T: Equatable {} | ||
|
||
class | ||
MoreThanOneLine | ||
{} | ||
|
||
class | ||
MoreThanOneLineInherit | ||
: | ||
Superclass | ||
{} | ||
|
||
class | ||
MoreThanOneLineInherit | ||
: | ||
Superclass1, | ||
Superclass2 | ||
{} | ||
|
||
class | ||
MoreThanOneLineInherit: | ||
Superclass | ||
{} | ||
|
||
final class | ||
MoreThanOneLineGeneric<T> | ||
where | ||
T: Param | ||
{} | ||
|
||
class Outer { | ||
class Inner<T> {} | ||
class InnerInherit: Superclass {} | ||
} | ||
|
||
struct TestStruct {} | ||
struct TestStruct: Conform {} | ||
struct TestStruct<T, U> {} | ||
|
||
enum TestEnum {} | ||
enum TestEnum: Conform {} | ||
enum TestEnum<T, U> {} | ||
|
||
actor TestActor {} | ||
actor TestActor: Conform {} | ||
actor TestActor<T, U> {} | ||
|
||
extension TestExtension {} | ||
extension TestExtension: Conform {} | ||
extension TestExtension<T, U> {} | ||
|
||
protocol TestProtocol {} | ||
protocol TestProtocol: Conform {} | ||
protocol TestProtocol<T, U> {} |