Skip to content

Commit ed5d458

Browse files
committed
add a test case
1 parent 7b4badd commit ed5d458

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/Semantic/Type/Trait.fs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,33 @@ fn main() {
234234
"add_poly", "<T0>|int, T0| -> int where int: Add<T0>" |]
235235
)
236236

237+
[<Fact>]
238+
let PolyReturn () =
239+
runAnalysis
240+
"
241+
trait Parse<T> {
242+
fn parse(self) -> T
243+
}
244+
245+
impl Parse<int> for int {
246+
fn parse(self) -> int {
247+
self
248+
}
249+
}
250+
251+
impl Parse<bool> for int {
252+
fn parse(self) -> bool {
253+
self >= 0
254+
}
255+
}
256+
257+
fn p() {
258+
let a = 1
259+
let b: bool = a.parse()
260+
let c: int = a.parse()
261+
}"
262+
|> toBe (Map [| "p", "|| -> ()" |])
263+
237264
[<Fact>]
238265
let AddDep () =
239266
runAnalysis

0 commit comments

Comments
 (0)