fuzion icon indicating copy to clipboard operation
fuzion copied to clipboard

Accessing instance of a function results in crash during `air` phase

Open fridis opened this issue 1 year ago • 0 comments

This example passes the instance of a function b as a boxed value to a routine expecting an argument of type Any

u(x Any) => _ := $x
b => u b.this
b

but this results in a crash:

 > ./build/bin/fz test_func.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.

or precondition failure:

 > PRECONDITIONS=true POSTCONDITIONS=true ./build/bin/fz test_func.fz

error 1: java.lang.Error: require-condition1 failed: AbstractFeature.java:1049 "(isTypeFeature() || hasTypeFeature());"
	at dev.flang.util.ANY.require(ANY.java:100)
	at dev.flang.ast.AbstractFeature.typeFeature(AbstractFeature.java:1049)
	at dev.flang.ast.AbstractType.typeType(AbstractType.java:1546)
	at dev.flang.ast.AbstractType.typeType(AbstractType.java:1513)
	at dev.flang.air.Clazz.typeClazz(Clazz.java:2166)
	at dev.flang.air.Clazz.determineResultClazz(Clazz.java:2278)
	at dev.flang.air.Clazz.dependencies(Clazz.java:486)
	at dev.flang.air.Clazzes.create(Clazzes.java:356)
	at dev.flang.air.Clazzes.clazzWithSpecificOuter(Clazzes.java:1071)
	at dev.flang.air.Clazz.lookup(Clazz.java:1337)

fridis avatar Jul 07 '24 10:07 fridis