Wiki

Ticket #337 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

Confusing message on missed 'of' in generics call

Reported by: hopscc Owned by: Chuck
Priority: medium Milestone:
Component: Cobra Compiler Version: 0.9.4
Keywords: Cc:

Description

Found by Chasm

Below program gives error msg
"The method "method" is expecting 1 argument, but no arguments are being supplied in this call. The declaration is "method(argument as T)""

class Program

    def main
        .method<int>(14)

    def method<of T>(argument as T)
        pass

Call is incorrect but parsed as a (invalid) ChainedCompare.

Probably easy enough to do if used to C* languages generics support.
<Type> vs <of Type> in cobra.

Perhaps trap this (based on comparison being to a Type) and emit a soothing corrective suggestion.

See  ForumTopic

Attachments

no-of-trap.patch Download (3.7 KB) - added by hopscc 4 years ago.

Change History

Changed 4 years ago by hopscc

Changed 4 years ago by hopscc

  • owner set to Chuck
  • status changed from new to assigned

Try this
Detect comparison to type and o/p message.
More tests

Changed 4 years ago by hopscc

related issue on ticket:118

Changed 4 years ago by Charles

Looking at the patch makes me think that catching "SomeClass?<int>" will be doable too.

Changed 4 years ago by Charles

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in changeset:3023

Forgot:
reported-by:Chasm

Note: See TracTickets for help on using tickets.