by kaushansky:
The following program doesn't compile, complains about unknown type
func iterateFast(s string) int {
acc:=0;
for i:=0;i<10;i++ {
acc+=len(s);
}
return acc; // fatal error: unknown etype 0/STRING
}
However, this variant compiles with no errors:
func iterateFast(s string) int {
s1:=s;
acc:=0;
for i:=0;i<10;i++ {
acc+=len(s1);
}
return acc; // no problem
}
I tried to localize the bug by removing for loop, but the following compiles just fine:
func iterateFast(s string) int {
acc:=0;
acc+=len(s);
return acc; // no problem
}