You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code has a somewhat misleading error message: there is a sum which is mutable, it's just not something we can reach:
The code in question
defsum(xs: List[Int]):Int= {
varsum= xs.foreach { x =>
sum = sum + x
// ^ ~~~
}
sum
}
Of course when you use res for the mutable variable and keep sum for the function, you get Could not resolve term res, which is probably a better message in this case.
The following code has a somewhat misleading error message: there is a
sum
which is mutable, it's just not something we can reach:The code in question
Of course when you use
res
for the mutable variable and keepsum
for the function, you getCould not resolve term res
, which is probably a better message in this case.I have no real use case for this, I just introduced a typo by accident in https://effekt-lang.org/tour/variables and then wondered for a brief moment.
Here's the relevant compiler code:
effekt/effekt/shared/src/main/scala/effekt/Namer.scala
Lines 516 to 521 in afb9ef0
The text was updated successfully, but these errors were encountered: