Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal to update generated function names #265

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions tests/src/main/java/testcases/KT008_funky_names/ChildScope.kt
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.KT008_funky_names

@motif.Scope
interface ChildScope {

@motif.Objects
abstract class Objects {

abstract fun myNull(): Null
}
}
102 changes: 102 additions & 0 deletions tests/src/main/java/testcases/KT008_funky_names/GRAPH.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
########################################################################
# #
# 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 ====

---- boolean | Objects.myBoolean ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myBoolean()

---- byte | Objects.myByte ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myByte()

---- char | Objects.myChar ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myChar()

---- double | Objects.myDouble ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myDouble()

---- float | Objects.myFloat ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myFloat()

---- int | Objects.myInt ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myInt()

---- Object | Objects.myAny ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myAny()

---- Function2<Long,Double,Short> | Objects.function2 ----
[ Required ]
[ Consumed By ]
* ChildScope | Objects.myNull(function2)

---- long | Objects.myLong ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myLong()

---- short | Objects.myShort ----
[ Required ]
[ Consumed By ]
* Scope | Scope.myShort()

---- Scope | implicit ----
[ Required ]
[ Consumed By ]

------------
| ChildScope |
------------

==== Required ====

---- Function2<Long,Double,Short> ----
[ Provided By ]
* Scope | Objects.function2
[ Consumed By ]
* ChildScope | Objects.myNull(function2)

==== Provides ====

---- ChildScope | implicit ----
[ Required ]
[ Consumed By ]

---- Null | Objects.myNull ----
[ Required ]
Function2<Long,Double,Short>
[ Provided By ]
* Scope | Objects.function2
[ Consumed By ]


18 changes: 18 additions & 0 deletions tests/src/main/java/testcases/KT008_funky_names/Null.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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.KT008_funky_names

class Null(function2: @JvmSuppressWildcards ((Long, Double) -> Short))
68 changes: 68 additions & 0 deletions tests/src/main/java/testcases/KT008_funky_names/Scope.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* 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.KT008_funky_names

import motif.Expose


@motif.Scope
interface Scope {

fun child(): ChildScope

fun myByte(): Byte
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to verify the name renderer change is not breaking stuff


fun myShort(): Short

fun myInt(): Int

fun myLong(): Long

fun myFloat(): Float

fun myDouble(): Double

fun myBoolean(): Boolean

fun myChar(): Char

fun myAny(): Any

@motif.Objects
open class Objects {

@Expose
fun function2(): ((Long, Double) -> Short) = { _, d -> d.toInt().toShort() }

fun myByte(): Byte = 3

fun myShort(): Short = 3

fun myInt(): Int = 3

fun myLong(): Long = 3

fun myFloat(): Float = 0.2f

fun myDouble(): Double = 0.2

fun myBoolean(): Boolean = true

fun myChar(): Char = 'c'

fun myAny(): Any = Any()
}
}
26 changes: 26 additions & 0 deletions tests/src/main/java/testcases/KT008_funky_names/Test.java
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.KT008_funky_names;

import static com.google.common.truth.Truth.assertThat;

public class Test {

public static void run() {
Scope scope = new ScopeImpl();
assertThat(scope.child()).isNotNull();
}
}
Loading