-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
While determining whether to create a no-arg convenience constructor, we check for both explicit (creatable) dependencies in addition to unsatisfied sinks to avoid generating incompatible code
- Loading branch information
1 parent
6a7863d
commit dfb9036
Showing
5 changed files
with
99 additions
and
1 deletion.
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
27 changes: 27 additions & 0 deletions
27
tests/src/main/java/testcases/KT007_scope_factory_dependencies/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,27 @@ | ||
######################################################################## | ||
# # | ||
# 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 ==== | ||
|
||
---- Scope | implicit ---- | ||
[ Required ] | ||
[ Consumed By ] | ||
|
||
|
26 changes: 26 additions & 0 deletions
26
tests/src/main/java/testcases/KT007_scope_factory_dependencies/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,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.KT007_scope_factory_dependencies | ||
|
||
import motif.Creatable | ||
|
||
@motif.Scope | ||
interface Scope : Creatable<Scope.Dependencies> { | ||
// note the absence of string() accessor (e.g. sink) in this scope | ||
interface Dependencies { | ||
fun string(): String | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/src/main/java/testcases/KT007_scope_factory_dependencies/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,34 @@ | ||
/* | ||
* 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.KT007_scope_factory_dependencies; | ||
|
||
import motif.ScopeFactory; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class Test { | ||
|
||
public static void run() { | ||
ScopeFactory.create( | ||
Scope.class, new Scope.Dependencies() { | ||
@NotNull | ||
@Override | ||
public String string() { | ||
return "s"; | ||
} | ||
} | ||
); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/src/main/java/testcases/KT007_scope_factory_dependencies/config.pro
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,10 @@ | ||
-libraryjars <java.home>/jmods/java.base.jmod(!**.jar;!module-info.class) | ||
-dontshrink | ||
-keep class **Test { | ||
public static void run(); | ||
} | ||
|
||
-keepnames @motif.Scope interface * | ||
-keepnames @motif.ScopeImpl class * { | ||
<init>(...); | ||
} |