... | ... | @@ -107,14 +107,12 @@ This error often triggers when: |
|
|
|
|
|
1. a: The programmer calls a function that just does not exist anywhere
|
|
|
1. The function is named sel
|
|
|
2. There exists a simiarly named function, e.g. detect typo
|
|
|
2. There exists a similarly named function, e.g. detect typo
|
|
|
3. There does not exist a similarly named function.
|
|
|
2. b: The programmer calls a version of a function that does not exist
|
|
|
1. Not assigning the result of the function to a variable.
|
|
|
Calling the version that returns void, which often does not exist.
|
|
|
2. Only incorrect number of return values but more than 0.
|
|
|
3. Only incorrect number of arguments.
|
|
|
4. Incorrect number of arguments AND return values!
|
|
|
2. Incorrect number of arguments AND return values!
|
|
|
|
|
|
# a
|
|
|
|
... | ... | @@ -190,71 +188,20 @@ Hint: |
|
|
• Or define a void-returning version `void %s(...) {}`)
|
|
|
```
|
|
|
|
|
|
## Info gathering for b2 b3 and b4
|
|
|
## b2
|
|
|
|
|
|
How do we know if the arity is right?
|
|
|
We need to ask two questions in order to get 3 awnsers.
|
|
|
|
|
|
1. Does an instance exist with the right amount of args?
|
|
|
2. Does an instance exist with the right amount of returns?
|
|
|
|
|
|
- If 1 and 2 then you wouldn't have the error so that never happens,
|
|
|
- If 1 and not 2 you had the wrong number of returns (case b2)
|
|
|
- If not 1 and 2 you had the wrong number of arguments (case b3)
|
|
|
- If not 1 and not 2 you had the wrong number of arguments and returns (case b4)
|
|
|
|
|
|
## b2
|
|
|
|
|
|
In this case we can say that the number of return values are wrong.
|
|
|
We can list the different numbers of valid return values.
|
|
|
|
|
|
At least get the different cases of functions.
|
|
|
We can still make the function type printer :)
|
|
|
|
|
|
```
|
|
|
Invalid call to foo:
|
|
|
The number of return values does not match any existing implementation.
|
|
|
|
|
|
Available implementations of foo include:
|
|
|
a, b = foo(...) (2 returns)
|
|
|
a, b, c = foo(...) (3 returns)
|
|
|
a, b, c, d = foo(...) (4 returns)
|
|
|
|
|
|
The number of arguments is correct. There is an instance with 1 argument.
|
|
|
```
|
|
|
|
|
|
## b3
|
|
|
|
|
|
In this case the we can say that the number of arguments is wrong.
|
|
|
We can list the different numbers of valid arguments.
|
|
|
|
|
|
```
|
|
|
"Invalid call to foo: the number of arguments does not match any existing implementation.
|
|
|
Available implementations of foo:
|
|
|
|
|
|
foo(arg1) (1 argument)
|
|
|
foo(arg1, arg2) (2 arguments)
|
|
|
foo(arg1, arg2, arg3) (3 arguments)
|
|
|
|
|
|
The number of return values is correct."
|
|
|
```
|
|
|
|
|
|
Hopefully we can get the types in there maybe or the arg names
|
|
|
|
|
|
## b4
|
|
|
|
|
|
In this case we say you got both the
|
|
|
In this case the arguments and the return values do not match an existing instance.
|
|
|
|
|
|
```
|
|
|
Invalid call to foo: the number of arguments and return values does not match any existing implementation.
|
|
|
Available implementations of foo:
|
|
|
|
|
|
a = foo(arg1) (1 argument, 1 return)
|
|
|
a, b = foo(arg1, arg2) (2 arguments, 2 returns)
|
|
|
a = foo(arg1, arg2, arg3) (3 arguments, 1 return)
|
|
|
a = foo(arg1) (1 argument) (1 return)
|
|
|
a, b = foo(arg1, arg2) (2 arguments) (2 returns)
|
|
|
a = foo(arg1, arg2, arg3) (3 arguments) (1 return)
|
|
|
```
|
|
|
|
|
|
Allign based on longest returns and longest arguments.
|
|
|
Align based on longest returns and longest arguments.
|
|
|
The tab at the start is nice!
|
|
|
|
|
|
## Type based suggestions
|
... | ... | |