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
You can add an arbitrary warnings to functions by adding a documentation comment starting with warning:. However, if such comments are added to members of data or class and they are called by "method-style" (what is the correct term for this?), the compiler doesn't warn about them.
Example:
moduleMainwheredataFoo=FooIntwhere--- warning: don't use this!get::Foo->Intget (Foox) =xclassHelloawhere--- warning: don't use this either!hello::a->StringinstanceHelloFoowhere
hello (Foo x) =show x
main::IO()
main =dolet foo =Foo1-- these get warnings
println (Foo.get foo)
println (hello foo)
-- but these don't
println foo.get
println foo.hello
The output of the compiler:
$ java -jar fregec.jar -ascii Main.fr
W Main.fr:20: Foo.get: don't use this!
W Main.fr:21: Hello.hello: don't use this either!
calling: javac -cp fregec.jar:. -d . -sourcepath . -encoding UTF-8 ./Main.java
The text was updated successfully, but these errors were encountered:
This is because the method names are resolved at different times.
The plain names or the ones prefixed with a type name will be resolved in pass 4 (I think).
Whereas the others are resolved during type checking (type directed name resolution).
It would probably possible to emit the warning then as well.
You can add an arbitrary warnings to functions by adding a documentation comment starting with
warning:
. However, if such comments are added to members ofdata
orclass
and they are called by "method-style" (what is the correct term for this?), the compiler doesn't warn about them.Example:
The output of the compiler:
The text was updated successfully, but these errors were encountered: