-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
copilot-prettyprinter
: Support pretty-printing struct updates
#526
Comments
Description Copilot currently supports modifying values from streams of structs, but not pretty-printing them using Type
Additional context
Requester
Method to check presence of bug Running the following specification that pretty-prints a spec with a struct update: {-# LANGUAGE DataKinds #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Main (main) where
import Data.Foldable (for_)
import Data.Functor (void)
import Data.Word (Word32)
import qualified Copilot.PrettyPrint as PP
import Language.Copilot
data S = S
{ unS :: Field "unS" Word32
}
instance Struct S where
typeName _ = "s"
toValues s = [Value typeOf (unS s)]
instance Typed S where
typeOf = Struct (S (Field 0))
spec :: Spec
spec = do
let externS :: Stream S
externS = extern "extern_s" Nothing
example :: Stream Word32
example = (externS ## unS =: 42) # unS
trigger "example" (example == example) [arg externS, arg example]
main :: IO ()
main = do
spec' <- reify spec
putStrLn $ PP.prettyPrint spec' produces an error message:
when it should instead execute correctly and pretty-print the spec. Expected result Copilot allows pretty-printing struct updates in Desired result Copilot allows pretty-printing struct updates in Proposed solution Introduce a case for pretty-printing struct updates. Further notes None. |
Change Manager: Confirmed that the issue exists. |
Technical Lead: Confirmed that the issue should be addressed. |
Technical Lead: Issue scheduled for fixing in Copilot 4. Fix assigned to: @RyanGlScott . |
…opilot-Language#526. This commit adds pretty-printing of expressions that update fields of a struct.
…opilot-Language#526. This commit adds pretty-printing of expressions that update fields of a struct.
Implementor: Solution implemented, review requested. |
…opilot-Language#526. This commit adds pretty-printing of expressions that update fields of a struct.
Change Manager: Verified that:
|
Change Manager: Implementation ready to be merged. |
Copilot 3.20 added support for struct updates via the new
UpdateField
operation. At the moment, there is no support in thecopilot-prettyprinter
package for pretty-printingUpdateField
operations. For example, this means that the following Copilot specification will fail when executed:I have a prototype fix available in this branch, which could be used as a starting point for a patch.
The text was updated successfully, but these errors were encountered: