Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why quoted values are EmptyFC? #3344

Open
freddi301 opened this issue Jul 5, 2024 · 0 comments
Open

Why quoted values are EmptyFC? #3344

freddi301 opened this issue Jul 5, 2024 · 0 comments

Comments

@freddi301
Copy link

freddi301 commented Jul 5, 2024

Steps to Reproduce

%macro
getTTImp : v -> Elab TTImp
getTTImp v = quote v

u1 = getFC $ getTTImp ('a' == 'b')  -- this has physicalIdrSrc

u2 = getFC $ getTTImp (True == False) -- this has emptyFc

Motivation for this issue: Trying to implement some testing utilities

getFilePosition : TTImp -> String
getFilePosition x = case getFC x of
  MkFC (PhysicalIdrSrc (MkMI path)) (line, column) _ => 
    "\{foldl (\a, i => a    "/"    i) "src" $ reverse path}.idr:\{show $ line   1}:\{show column}"
  MkFC _ _ _ => "MkFC"
  MkVirtualFC _ _ _ => "MkVirtualFC"
  EmptyFC => "EmptyFc"
  -- _ => ""

public export
%macro
assert : (() -> Bool) -> Elab (IO ())
assert condition = do
  condition_quoted <- quote condition
  let position = getFilePosition condition_quoted
  let position_quoted = IPrimVal EmptyFC (Str position)
  check `(if ~(condition_quoted) then putStrLn "SUCCESS \{~(position_quoted)}" else putStrLn "FAILURE \{~(position_quoted)}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant