"can't compile top-level term with free variables"

haskell tests all passing
scala tests, 207 passing
  17 FAILED (failed scopes below)
    compilation.file.state2b-min = 20 - java.lang.RuntimeException: Can't compile top-level term with free variables +
    compilation.file.state4 = 15 - java.lang.RuntimeException: Can't compile top-level term with free variables +
    compilation.file.console - java.lang.RuntimeException: Can't compile top-level term with free variables cons, drop, at
    compilation.file.map-reduce - java.lang.RuntimeException: Can't compile top-level term with free variables size, drop, take, to-sequence    compilation.file.ask-inferred - java.lang.RuntimeException: Can't compile top-level term with free variables size
    compilation.file.tdnr2 - java.lang.RuntimeException: Can't compile top-level term with free variables +, -
    compilation.file.pattern-matching - java.lang.RuntimeException: Can't compile top-level term with free variables +
    compilation.file.tictactoe0 - java.lang.RuntimeException: Can't compile top-level term with free variables not
    compilation.file.tictactoe - java.lang.RuntimeException: Can't compile top-level term with free variables not
    compilation.file.sequence-at-0 - java.lang.RuntimeException: Can't compile top-level term with free variables at
    compilation.file.tdnr3 - java.lang.RuntimeException: Can't compile top-level term with free variables +, bar
    compilation.file.state2b - java.lang.RuntimeException: Can't compile top-level term with free variables +
    compilation.file.language-reference - java.lang.RuntimeException: Can't compile top-level term with free variables +, *
    compilation.file.state2a-min - java.lang.RuntimeException: Can't compile top-level term with free variables +
    compilation.file.tictactoe2 - java.lang.RuntimeException: Can't compile top-level term with free variables not
    compilation.file.state2a - java.lang.RuntimeException: Can't compile top-level term with free variables +
    compilation.file.tdnr - java.lang.RuntimeException: Can't compile top-level term with free variables +
This commit is contained in:
Arya Irani 2018-11-01 21:31:57 -04:00
parent 9c91de6c35
commit dd73dbda36
3 changed files with 3 additions and 6 deletions

View File

@ -40,7 +40,6 @@ import qualified Unison.UnisonFile as UF
import Unison.Var (Var)
import qualified Unison.Var as Var
import Debug.Trace
import Unison.Util.Monoid
type Term v = AnnotatedTerm v Ann
type Type v = AnnotatedType v Ann
@ -112,11 +111,10 @@ synthesizeFile names0 unisonFile = do
Result notes mayType =
evalStateT (Typechecker.synthesizeAndResolve env0) tdnrTerm
infos = Foldable.toList $ Typechecker.infos notes
components = trace ("---components:---\n" ++ cs) extractComponents term
where cs = intercalateMap "\n" show ([(1::Int)..] `zip` (Map.toList $ extractComponents term))
components = Map.mapKeys Var.name $ extractComponents term
tlcsFromTypechecker = [ t | Context.TopLevelComponent t <- infos ]
substTLC (v, typ, redundant) = do
tm <- case Map.lookup v components of
tm <- case Map.lookup (Var.name v) components of
Nothing ->
Result.tellAndFail
. Result.CompilerBug

View File

@ -81,4 +81,3 @@ fromParsing = fromParsing'
tellAndFail :: Monad f => note -> ResultT (Seq note) f a
tellAndFail note = tell1 note *> Fail.fail "Elegantly and responsibly"

View File

@ -34,7 +34,7 @@ instance Ord Symbol where
Symbol id1 name1 `compare` Symbol id2 name2 = (id1,name1) `compare` (id2,name2)
instance Show Symbol where
show (Symbol 0 n) = Text.unpack n
show (Symbol id n) = Text.unpack n ++ show id
show (Symbol id n) = Text.unpack n ++ "-" ++ show id
symbol :: Text -> Symbol
symbol n = Symbol 0 n