-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump the gradle group with 2 updates (#110)
- Loading branch information
1 parent
9d67432
commit be9d2b5
Showing
6 changed files
with
36 additions
and
12 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
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
24 changes: 19 additions & 5 deletions
24
...n/src/main/kotlin/tech/mappie/validation/problems/classes/UnknownParameterNameProblems.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 |
---|---|---|
@@ -1,17 +1,31 @@ | ||
package tech.mappie.validation.problems.classes | ||
|
||
import org.jetbrains.kotlin.ir.util.fileEntry | ||
import org.jetbrains.kotlin.name.Name | ||
import tech.mappie.resolving.ClassMappingRequest | ||
import tech.mappie.resolving.classes.sources.ClassMappingSource | ||
import tech.mappie.resolving.classes.sources.ExplicitClassMappingSource | ||
import tech.mappie.util.location | ||
import tech.mappie.validation.Problem | ||
import tech.mappie.validation.ValidationContext | ||
|
||
class UnknownParameterNameProblems(private val unknowns: Set<Name>) { | ||
class UnknownParameterNameProblems( | ||
private val context: ValidationContext, | ||
private val unknowns: Map<Name, List<ClassMappingSource>>, | ||
) { | ||
|
||
fun all(): List<Problem> = unknowns.map { | ||
Problem.error("Identifier ${it.asString()} does not occur as as setter or as a parameter in constructor") | ||
fun all(): List<Problem> = unknowns.map { (name, sources) -> | ||
Problem.error( | ||
"Identifier ${name.asString()} does not occur as as setter or as a parameter in constructor", | ||
when (val source = sources.firstOrNull()) { | ||
is ExplicitClassMappingSource -> location(context.function.fileEntry, source.origin) | ||
else -> location(context.function) | ||
} | ||
) | ||
} | ||
|
||
companion object { | ||
fun of(mapping: ClassMappingRequest): UnknownParameterNameProblems = | ||
UnknownParameterNameProblems(mapping.unknowns.keys) | ||
fun of(context: ValidationContext, mapping: ClassMappingRequest): UnknownParameterNameProblems = | ||
UnknownParameterNameProblems(context, mapping.unknowns) | ||
} | ||
} |
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