Skip to content

Commit

Permalink
Merge branch 'main' into ja-increase-currying-test-coverage-arrow-kt#…
Browse files Browse the repository at this point in the history
  • Loading branch information
serras authored Mar 31, 2023
2 parents 6dae5aa + 4dfdd62 commit 910baa4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ fun String.plusIfNotBlank(prefix: String = "", postfix: String = "") =
/**
* Sanitizes each delimited section if it matches with Kotlin reserved keywords.
*/
fun KSName.asSanitizedString(delimiter: String = ".", separator: String = delimiter) =
asString().splitToSequence(delimiter).joinToString(separator) { if (kotlinKeywords.contains(it)) "`$it`" else it }
fun KSName.asSanitizedString(delimiter: String = ".") =
asString().splitToSequence(delimiter).joinToString(delimiter) { if (it in kotlinKeywords) "`$it`" else it }


private val kotlinKeywords = setOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,20 @@ class DSLTests {
""".compilationSucceeds()
}

@Test
fun `DSL for a class in a package including keywords, issue #2996`() {
"""
|package id.co.app_name.features.main.transaction.internal.outgoing.data.OutgoingInternalTransaction
|
|$imports
|
|@optics
|data class Source(val program: String) {
| companion object
|}
|
""".compilationSucceeds()
}

// Db.content.at(At.map(), One).set(db, None)
}

0 comments on commit 910baa4

Please sign in to comment.