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

Small example using boxing and partial application results in throwing Error. #3315

Closed
fridis opened this issue Jul 4, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working front end related to the front end until .fum file is created: call and type resolution, type checking, etc. middle end related to the Middle End that creates Fuzion Application from Fuzion Modules

Comments

@fridis
Copy link
Member

fridis commented Jul 4, 2024

This is somewhat realted to #3308 and #3314.
This code

f(x ()->unit) =>
s(x Any) =>
say (f (s unit))

produces

 > ./build/bin/fz partial_bug.fz 
Missing handling of class dev.flang.ast.This class dev.flang.ast.ExprWithPos in LibraryOut.expressions
Missing handling of class dev.flang.ast.This class dev.flang.ast.ExprWithPos in LibraryOut.expressions

error 1: java.lang.Error: class dev.flang.ast.This should no longer exist at runtime
	at dev.flang.air.Clazzes.clazz(Clazzes.java:1004)
	at dev.flang.air.Clazzes.findClazzes(Clazzes.java:742)
	at dev.flang.air.Clazz$EV.action(Clazz.java:169)
	at dev.flang.ast.Expr.visitExpressions(Expr.java:338)
	at dev.flang.ast.AbstractCall.visitExpressions(AbstractCall.java:99)
	at dev.flang.ast.Box.visitExpressions(Box.java:155)
	at dev.flang.ast.AbstractCall.visitExpressions(AbstractCall.java:93)
	at dev.flang.ast.AbstractAssign.visitExpressions(AbstractAssign.java:139)
	at dev.flang.ast.AbstractFeature.visitExpressions(AbstractFeature.java:1594)
	at dev.flang.air.Clazz.inspectCode(Clazz.java:1534)
	at dev.flang.air.Clazz.findAllClasses(Clazz.java:1578)
	at dev.flang.air.Clazzes.findAllClasses(Clazzes.java:408)
	at dev.flang.fuir.FUIR.<init>(FUIR.java:187)
	at dev.flang.opt.Optimizer.fuir(Optimizer.java:73)
	at dev.flang.tools.Fuzion$Backend.processFrontEnd(Fuzion.java:506)
	at dev.flang.tools.Fuzion.lambda$parseArgsForBackend$3(Fuzion.java:1071)
	at dev.flang.tools.Tool.lambda$run$0(Tool.java:141)
	at dev.flang.util.Errors.runAndExit(Errors.java:957)
	at dev.flang.tools.Tool.run(Tool.java:141)
	at dev.flang.tools.Fuzion.main(Fuzion.java:626)


*** fatal errors encountered, stopping.
one error.
@fridis fridis added bug Something isn't working front end related to the front end until .fum file is created: call and type resolution, type checking, etc. middle end related to the Middle End that creates Fuzion Application from Fuzion Modules labels Jul 4, 2024
@fridis fridis self-assigned this Jul 4, 2024
@fridis fridis changed the title Small example using Boxing and partial application results in throwing Error. Small example using boxing and partial application results in throwing Error. Jul 4, 2024
@fridis
Copy link
Member Author

fridis commented Jul 5, 2024

A slightly extended example might help to give some more insight:

f(x ()->unit) => _ := x.call
a is
  redef as_string => "--a--"
  s(x Any) => say x
  say (f (s a.this))

_ := a

results in

 > ~/fuzion/work/build/bin/fz reg_issue3308a.fz

error 1: Found error clazz in set of clazzes in the IR even though no earlier errors were reported.  This can only be the result of a severe bug.

one error.

The problem seems to be that on the call to s a.this, an attempt is made to box a.fun.call and not a.fun.call.outer.outer, resulting in chaos.

fridis added a commit that referenced this issue Jul 7, 2024
Also duplicated the tests in `reg_issue3308` to be executed within a function
`b` additionally to the constructor `a`.  This includes the case from #3324,
which is currently commented out in the test.
michaellilltokiwa added a commit that referenced this issue Jul 8, 2024
ast/tests: Repeat type resolution for arguments in lambda to fix #3315 and fix #3308
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working front end related to the front end until .fum file is created: call and type resolution, type checking, etc. middle end related to the Middle End that creates Fuzion Application from Fuzion Modules
Projects
None yet
Development

No branches or pull requests

1 participant