mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-24 20:23:11 +03:00
[ new ] allow auto
fields in records
This commit is contained in:
parent
17b3bb8d3d
commit
9c59542081
@ -1251,7 +1251,8 @@ fieldDecl fname indents
|
||||
= do doc <- option "" documentation
|
||||
symbol "{"
|
||||
commit
|
||||
fs <- fieldBody doc Implicit
|
||||
impl <- option Implicit (AutoImplicit <$ keyword "auto")
|
||||
fs <- fieldBody doc impl
|
||||
symbol "}"
|
||||
atEnd indents
|
||||
pure fs
|
||||
|
@ -95,6 +95,7 @@ idrisTests
|
||||
"real001", "real002",
|
||||
-- Records, access and dependent update
|
||||
"record001", "record002", "record003", "record004", "record005",
|
||||
"record007",
|
||||
-- Quotation and reflection
|
||||
"reflection001", "reflection002", "reflection003", "reflection004",
|
||||
"reflection005", "reflection006", "reflection007", "reflection008",
|
||||
|
6
tests/idris2/record007/Fld.idr
Normal file
6
tests/idris2/record007/Fld.idr
Normal file
@ -0,0 +1,6 @@
|
||||
record Is3 (n : Nat) where
|
||||
constructor MkThree
|
||||
{auto prf : n === 3}
|
||||
|
||||
three : Is3 3
|
||||
three = MkThree
|
3
tests/idris2/record007/expected
Normal file
3
tests/idris2/record007/expected
Normal file
@ -0,0 +1,3 @@
|
||||
1/1: Building Fld (Fld.idr)
|
||||
Main> Main> MkThree {n = 3} {prf = Refl {a = Nat} {x = 3}}
|
||||
Main> Bye for now!
|
3
tests/idris2/record007/input
Normal file
3
tests/idris2/record007/input
Normal file
@ -0,0 +1,3 @@
|
||||
:set showimplicits
|
||||
three
|
||||
:q
|
3
tests/idris2/record007/run
Executable file
3
tests/idris2/record007/run
Executable file
@ -0,0 +1,3 @@
|
||||
$1 --no-color --console-width 0 --no-banner Fld.idr < input
|
||||
|
||||
rm -rf build
|
Loading…
Reference in New Issue
Block a user