-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: accidental ownership with specialization
- Loading branch information
Showing
5 changed files
with
57 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/-! Check for bug accidentally marking `m` as owned. -/ | ||
|
||
class MyClass (α : Type u) where | ||
|
||
instance : MyClass Nat where | ||
|
||
inductive MyOption (α : Type u) where | ||
| none | ||
| some (key : α) | ||
|
||
namespace MyOption | ||
|
||
def isSomeWithInstance [MyClass α] : MyOption α → Bool | ||
| none => false | ||
| some _ => true | ||
|
||
def isSome : MyOption α → Bool | ||
| none => false | ||
| some _ => true | ||
|
||
end MyOption | ||
|
||
set_option trace.compiler.ir.result true in | ||
def isSomeWithInstanceNat (m : { m : Array (MyOption Nat) // 0 < m.size }) : Bool := | ||
(m.1.uget 0 m.2).isSomeWithInstance |
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,26 @@ | ||
|
||
[result] | ||
def MyOption.isSomeWithInstance._at.isSomeWithInstanceNat._spec_1 (x_1 : @& obj) : u8 := | ||
case x_1 : obj of | ||
MyOption.none → | ||
let x_2 : u8 := 0; | ||
ret x_2 | ||
MyOption.some → | ||
let x_3 : u8 := 1; | ||
ret x_3 | ||
def isSomeWithInstanceNat (x_1 : @& obj) : u8 := | ||
let x_2 : usize := 0; | ||
let x_3 : obj := Array.uget ◾ x_1 x_2 ◾; | ||
let x_4 : u8 := MyOption.isSomeWithInstance._at.isSomeWithInstanceNat._spec_1 x_3; | ||
dec x_3; | ||
ret x_4 | ||
def MyOption.isSomeWithInstance._at.isSomeWithInstanceNat._spec_1._boxed (x_1 : obj) : obj := | ||
let x_2 : u8 := MyOption.isSomeWithInstance._at.isSomeWithInstanceNat._spec_1 x_1; | ||
dec x_1; | ||
let x_3 : obj := box x_2; | ||
ret x_3 | ||
def isSomeWithInstanceNat._boxed (x_1 : obj) : obj := | ||
let x_2 : u8 := isSomeWithInstanceNat x_1; | ||
dec x_1; | ||
let x_3 : obj := box x_2; | ||
ret x_3 |
This file was deleted.
Oops, something went wrong.