Skip to content

Commit

Permalink
test: type check default values of parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Feb 25, 2024
1 parent 070ad8b commit 72a9bbf
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package tests.validation.types.checking.defaultValues

class SomeClass<T1, T2 sub Number>(
// $TEST$ no error r"Expected type .* but got .*\."
p1: T1 = »true«,
// $TEST$ no error r"Expected type .* but got .*\."
p2: T1 = »1«,
// $TEST$ error "Expected type 'T2' but got 'literal<"">'."
p3: T2 = »""«,
)

fun someFunction<T1, T2 sub Number>(
// $TEST$ no error r"Expected type .* but got .*\."
p1: T1 = »true«,
// $TEST$ no error r"Expected type .* but got .*\."
p2: T1 = »1«,
// $TEST$ error "Expected type 'T2' but got 'literal<"">'."
p3: T2 = »""«,
)

0 comments on commit 72a9bbf

Please sign in to comment.