Opened 3 years ago

Last modified 17 months ago

#1198 new enhancement

Allow `the` to override inferred types

Reported by: evhan Owned by:
Priority: minor Milestone: someday
Component: scrutinizer Version: 4.9.x
Keywords: types, strict-types, compiler Cc:
Estimated difficulty: hard


the can currently specialize an expression's inferred type to a more specific one, but it can't also generalize it to a less specific one when -strict-types is used (an error is signaled during compilation when the declared type is more general than the inferred type):

Warning: in toplevel procedure `foo?':
  expression returns a result of type `fixnum', but is declared to return `number', which is not a subtype

Error: some variable types do not satisfy strictness

This would be useful for the purpose described in this thread (specifically here).

Change History (1)

comment:1 Changed 17 months ago by sjamaan

  • Estimated difficulty set to hard
Note: See TracTickets for help on using tickets.