Ticket #337 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 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:


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

    def method<of T>(argument as T)

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


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

Change History

Changed 5 years ago by hopscc

Changed 5 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 5 years ago by hopscc

related issue on ticket:118

Changed 5 years ago by Charles

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

Changed 5 years ago by Charles

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

Fixed in changeset:3023


Note: See TracTickets for help on using tickets.