8000 majestic: fix bubbling + type annotations for option metadata by phantamanta44 · Pull Request #180 · GrammaticalFramework/gf-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

majestic: fix bubblin 8000 g + type annotations for option metadata #180

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

Merged
merged 3 commits into from
Jun 8, 2025

Conversation

phantamanta44
Copy link

No description provided.

@krangelov
Copy link
Member

I looked at the conflict. The problem is in the bubble function. I like that you made a function, but your implementation seems to always propagate the variants to the top level. It is essential that in bubble variants are propagated upwards only if variants with the same choice id appear in more than one place. This happens in addVariants but you seem to miss that.

@phantamanta44
Copy link
Author

Rebased onto current majestic. Also, here's the modified repl i'm using for testing:

diff --git a/src/compiler/api/GF/Compile/Repl.hs b/src/compiler/api/GF/Compile/Repl.hs
index 066ee1dc1..36a169904 100644
--- a/src/compiler/api/GF/Compile/Repl.hs
+++ b/src/compiler/api/GF/Compile/Repl.hs
@@ -59,6 +59,8 @@ import GF.Infra.Option (noOptions)
 import GF.Infra.UseIO (justModuleName)
 import GF.Text.Pretty (render)
 
+import Debug.Trace
+
 data ReplOpts = ReplOpts
   { lang :: Lang
   , noPrelude :: Bool
@@ -275,7 +277,16 @@ runRepl' opts@ReplOpts { lang, evalToFlat } gl@(Gl g _) = do
 
     doEval st t opts = inferLType gl t >>= \case
       []          -> fail $ "No result while checking type: " ++ render (ppTerm Unqualified 0 t)
-      ((t', _):_) -> runEvalMWithOpts gl opts (value2termM evalToFlat [] (eval gl [] unit t' []))
+      ((t', _):_) -> runEvalMWithOpts gl opts $ do
+        let v = eval gl [] unit t' []
+        traceM $ ("EVAL\n" ++) $ render $ ppValue Unqualified 0 v
+        
+        let v' = bubble v
+        traceM $ ("BUBBLE\n" ++) $ render $ ppValue Unqualified 0 v'
+        
+        tv <- value2termM evalToFlat [] v'
+        traceM $ ("VALUE2TERM\n" ++) $ render $ ppTerm Unqualified 0 tv
+        return tv
     
     outputResults rs =
       forM_ (zip [1..] rs) $ \(i, ResultState r _ opts _) ->
$ gfci --lang=nlg --no-flat

@krangelov krangelov merged commit 09e98ed into GrammaticalFramework:majestic Jun 8, 2025
1 of 17 checks passed
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

Successfully merging this pull request may close these issues.

2 participants
0