Issue2664.agda 916 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. -- Andreas, 2017-08-10, issue #2664, reported by csetzer
  2. -- Test case by Ulf
  3. -- {-# OPTIONS -v tc.rec:40 #-}
  4. -- {-# OPTIONS -v tc.cc:60 #-}
  5. open import Agda.Builtin.IO
  6. open import Agda.Builtin.String
  7. open import Agda.Builtin.Unit
  8. open import Agda.Builtin.Nat
  9. mutual
  10. -- Error WAS:
  11. -- The presence of mutual affected the compilation of the projections
  12. -- since it triggered a record pattern translation for them.
  13. record R : Set where
  14. constructor mkR
  15. field
  16. dummy : Nat
  17. str : String
  18. helloWorld : R
  19. helloWorld = mkR 0 "Hello World!"
  20. postulate
  21. putStrLn : String → IO ⊤
  22. {-# FOREIGN GHC import qualified Data.Text.IO as Text #-}
  23. {-# COMPILE GHC putStrLn = Text.putStrLn #-}
  24. {-# COMPILE JS putStrLn = function(x) { return function(cb) { process.stdout.write(x + "\n"); cb(0); }; } #-}
  25. main : IO ⊤
  26. main = putStrLn (R.str helloWorld)
  27. -- Expected: Should print
  28. --
  29. -- Hello World!