-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the handling of equality constraints involving concrete types
- Loading branch information
1 parent
50445c2
commit c48c53b
Showing
2 changed files
with
21 additions
and
1 deletion.
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
20 changes: 20 additions & 0 deletions
20
Tests/HyloTests/TestCases/TypeChecking/ConditionalExtension3.hylo
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//- typeCheck expecting: .failure | ||
|
||
type Box<Contents: Regular> { | ||
public var contents: Contents | ||
public memberwise init | ||
} | ||
|
||
extension Box where Contents == Int { | ||
public fun contains_zero() -> Bool { | ||
contents == 0 | ||
} | ||
} | ||
|
||
public fun main() { | ||
let b0 = Box(contents: true) | ||
_ = b0.contains_zero() //! diagnostic reference to 'contains_zero' requires that 'Bool' be equal to 'Int' | ||
|
||
let b1 = Box(contents: 1) | ||
_ = b1.contains_zero() | ||
} |