amber-lang / amber-lang/amber

[BUG] Aliased methods cause invalid function call

Aperta
#1,003 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
bug compiler
Lingua principale
Rust
Stelle
5.2k
Fork
145
Merge medio
5g 3h
PR unite (30g)
7

Descrizione

**Describe the bug**
When declaring a public method which is then imported but aliased to a different name, when called, code is emitted that calls a non-existing method:
```
./main.sh: line 8: template_of_template__0_v0: command not found
```

**To Reproduce**

Source files:
```rs
//template.ab
pub fun template() {
echo("This is a template function.");
}
```

and:
```rs
//main.ab
import {
template as template_of_template
} from "./template.ab";

main {
template_of_template();
}
```

compiled with:
```
$ amber --version
amber 75a5702
$ amber build main.ab
```

compiles to:
```sh
#!/usr/bin/env bash
# Written in [Amber](https://amber-lang.com/)
# version: 75a5702
template__0_v0() {
echo "This is a template function."
}

template_of_template__0_v0
```

**Expected behavior**
Original function should be copied and either shim should be created or aliased should be treated purely semantically and still resolve the original symbol name. Same function should be callable with both original and aliased method

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.