forked from uber/motif
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This avoids the infinite poetry in uber#255
- Loading branch information
1 parent
ed96a0a
commit 44f1760
Showing
6 changed files
with
168 additions
and
20 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
24 changes: 24 additions & 0 deletions
24
tests/src/main/java/testcases/KT006_reference_self/Child.kt
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (c) 2023 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package testcases.KT006_reference_self | ||
|
||
@motif.Scope | ||
interface Child { | ||
|
||
@motif.Objects | ||
abstract class Objects : ObjectComponent<Bar> | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2023 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package testcases.KT006_reference_self | ||
|
||
interface Foo<T> | ||
class Bar : Foo<Bar> | ||
interface ObjectComponent<T: Foo<T>> { | ||
fun generic(someFoo: T): Foo<T> | ||
} |
57 changes: 57 additions & 0 deletions
57
tests/src/main/java/testcases/KT006_reference_self/GRAPH.txt
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
######################################################################## | ||
# # | ||
# This file is auto-generated by running the Motif compiler tests and # | ||
# serves a as validation of graph correctness. IntelliJ plugin tests # | ||
# also rely on this file to ensure that the plugin graph understanding # | ||
# is equivalent to the compiler's. # | ||
# # | ||
# - Do not edit manually. # | ||
# - Commit changes to source control. # | ||
# - Since this file is autogenerated, code review changes carefully to # | ||
# ensure correctness. # | ||
# # | ||
######################################################################## | ||
|
||
------- | ||
| Scope | | ||
------- | ||
|
||
==== Required ==== | ||
|
||
==== Provides ==== | ||
|
||
---- Bar | Objects.bar ---- | ||
[ Required ] | ||
[ Consumed By ] | ||
* Child | Objects.generic(someFoo) | ||
|
||
---- Scope | implicit ---- | ||
[ Required ] | ||
[ Consumed By ] | ||
|
||
------- | ||
| Child | | ||
------- | ||
|
||
==== Required ==== | ||
|
||
---- Bar ---- | ||
[ Provided By ] | ||
* Scope | Objects.bar | ||
[ Consumed By ] | ||
* Child | Objects.generic(someFoo) | ||
|
||
==== Provides ==== | ||
|
||
---- Child | implicit ---- | ||
[ Required ] | ||
[ Consumed By ] | ||
|
||
---- Foo<Bar> | Objects.generic ---- | ||
[ Required ] | ||
Bar | ||
[ Provided By ] | ||
* Scope | Objects.bar | ||
[ Consumed By ] | ||
|
||
|
31 changes: 31 additions & 0 deletions
31
tests/src/main/java/testcases/KT006_reference_self/Scope.kt
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2023 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package testcases.KT006_reference_self | ||
|
||
import motif.Expose | ||
|
||
@motif.Scope | ||
interface Scope { | ||
|
||
fun child(): Child | ||
|
||
@motif.Objects | ||
abstract class Objects { | ||
|
||
@Expose | ||
fun bar(): Bar = Bar() | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/src/main/java/testcases/KT006_reference_self/Test.java
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) 2023 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package testcases.KT006_reference_self; | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
|
||
public class Test { | ||
|
||
public static void run() { | ||
Scope scope = new ScopeImpl(); | ||
assertThat(scope.child()).isNotNull(); | ||
} | ||
} |