Opened 6 years ago

Closed 3 years 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 5 years ago by sjamaan

Estimated difficulty: hard

comment:2 Changed 3 years ago by evhan

Milestone: someday4.10.0
Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.