-
Notifications
You must be signed in to change notification settings - Fork 9
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
Avoid erasing types and delegate to js export #39
Merged
glureau
merged 4 commits into
deezer:master
from
MarcoSignoretto:avoid_erasing_types_and_delegate_to_JsExport
Jul 27, 2023
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,6 +185,58 @@ class TypeMappingTest { | |
) | ||
} | ||
|
||
@Test | ||
fun maps() { | ||
assertCompilationOutput( | ||
""" | ||
package foo.bar | ||
import deezer.kustomexport.KustomExport | ||
|
||
@KustomExport | ||
class ClassWithMaps { | ||
var myMap: Map<String, Int> | ||
} | ||
""", | ||
ExpectedOutputFile( | ||
path = "foo/bar/js/ClassWithMaps.kt", | ||
content = """ | ||
package foo.bar.js | ||
|
||
import kotlin.Int | ||
import kotlin.String | ||
import kotlin.Suppress | ||
import kotlin.collections.Map | ||
import kotlin.js.JsExport | ||
import foo.bar.ClassWithMaps as CommonClassWithMaps | ||
|
||
@JsExport | ||
public class ClassWithMaps() { | ||
internal var common: CommonClassWithMaps | ||
|
||
init { | ||
common = CommonClassWithMaps() | ||
} | ||
|
||
public var myMap: Map<String, Int> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. before this was like |
||
get() = common.myMap | ||
set(setValue) { | ||
common.myMap = setValue | ||
} | ||
|
||
@Suppress("UNNECESSARY_SAFE_CALL") | ||
internal constructor(common: CommonClassWithMaps) : this() { | ||
this.common = common | ||
} | ||
} | ||
|
||
public fun CommonClassWithMaps.exportClassWithMaps(): ClassWithMaps = ClassWithMaps(this) | ||
|
||
public fun ClassWithMaps.importClassWithMaps(): CommonClassWithMaps = this.common | ||
""".trimIndent() | ||
) | ||
) | ||
} | ||
|
||
@Test | ||
fun from_Long_to_Double() { | ||
assertCompilationOutput( | ||
|
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,4 @@ | ||
kotlin.mpp.stability.nowarn=true | ||
kotlin.mpp.enableGranularSourceSetsMetadata=true | ||
kotlin.native.enableDependencyPropagation=false | ||
|
||
kotlinVersion=1.7.22 | ||
kspVersion=1.7.22-1.0.8 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work! Regarding the comments, I'm afraid that this change implies regression for types with generics. Maybe it was due to a previous Kotlin version and kt 1.7 or 1.8 doesn't require it anymore. Do you mind to investigate a bit further to check if we could have regressions?
Full disclosure, I don't use this tool anymore and don't have access to the original project to check if this is fine or not, so eventually I'll trust your judgement, just let me know ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check. @glureau I saw also that some unit tests are failing, do you mind if I setup a workflow on GitHub Actions to run tests on PRs? for open source repo it should be free.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glureau also I need the approval to run the PR workflow you have: https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC I stopped running unit tests and instead only used the typescripts one (kind of integration tests), as I believe they have much more values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like grgit dependency is failing the github CI. Please check locally the output of this script, we'll have to fix the CI later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is failing let me have a look