typhon icon indicating copy to clipboard operation
typhon copied to clipboard

InterfaceExpr introduces scope box for exprs in signatures

Open dckc opened this issue 6 years ago • 1 comments

When I try to monte eval scopeBug.mt:

exports (main)

def Ast :DeepFrozen := astBuilder.getAstGuard()

interface TypeVariable :DeepFrozen {
    to setInstance(other: (def AstType :DeepFrozen := Any[Ast, TypeVariable]))
}


def main(_) as DeepFrozen:
    traceln(AstType)
    traceln(TypeVariable)

I get:

TRACE: time 1552600639.209721 vat pa
 ~ "Loader args: [\"run\", \"scopeBug\", \"eval\", \"scopeBug.mt\"]"
TRACE: time 1552600639.209760 vat pa
 ~ "Loading scopeBug"
Name AstType has no scope
RPython traceback:
  File "implement.c", line 58, in entryPoint
  File "implement.c", line 4137, in runTyphon
  File "implement.c", line 5954, in runUntilDone
  File "typhon_vats.c", line 449, in Vat_takeSomeTurns
  File "typhon_vats.c", line 1544, in Vat_takeTurn
  File "typhon_objects.c", line 5690, in Object_callAtom
  File "implement.c", line 32882, in WhenReactor_recvNamed
  File "typhon_objects.c", line 42098, in WhenReactor_run
  File "typhon_objects.c", line 5690, in Object_callAtom
  File "typhon_nano.c", line 9903, in InterpObject_runMethod
  File "implement_1.c", line 42501, in Pass_visitExpr_1
  File "typhon_nano.c", line 19173, in Evaluator_visitSeqExpr
  File "typhon_nano.c", line 14749, in Evaluator_visitDefExpr
  File "typhon_nano.c", line 14150, in Evaluator_visitCallExpr
  File "typhon_objects.c", line 5690, in Object_callAtom
  File "implement_4.c", line 62726, in AstEval0_recvNamed
  File "typhon_scopes.c", line 12898, in AstEval0_evalToPair
  File "typhon_nano_1.c", line 37235, in evalToPair
  File "typhon_nano.c", line 233, in evalMonte
  File "typhon_nano.c", line 5488, in mainPipeline
  File "implement_2.c", line 46128, in Pass_visitExpr_14
  File "typhon_nano_1.c", line 11433, in ScopeFrame_computeFrameTable
Fatal RPython error: CompilerFailed

dckc avatar Mar 14 '19 21:03 dckc

The name verifier incorrectly treats InterfaceExpr as not introducing a scope box, and by our syntax principles it's quite surprising that it does. So AstType being undefined in traceln(AstType) is not caught statically, and thus produces this error at runtime.

washort avatar Mar 14 '19 22:03 washort