Opened 3 years ago

Closed 6 months ago

#1198 closed enhancement (fixed)

Allow `the` to override inferred types

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

Description

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 (2)

comment:1 Changed 2 years ago by sjamaan

  • Estimated difficulty set to hard

comment:2 Changed 6 months ago by evhan

  • Milestone changed from someday to 4.10.0
  • Resolution set to fixed
  • Status changed from new to closed

This was fixed long ago in 7f928ac2 (master) and 1939cbb9 (chicken-4).

Note: See TracTickets for help on using tickets.