Ticket #3876 (closed bug: wontfix)

Opened 3 years ago

Last modified 3 years ago

assignement of thrown extension to variable of type string

Reported by: andrewufrank Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.10.4
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo) (diff)

in an unusual case (exception thrown in code in the return) the thrown exception is returned from the function and then assigned to a variable with another type (e.g. string); if the variable is later evaluated, the exception is then actually thrown there (and not in the original function).

the bug is the problem in the asignement of a thrown exception to another type. the coding style is unfortunate and not encourage, but the compiler should report an error. (code like

             = do ...
                return (case x of 
                           0 -> throw Anexception
                        )

produces the error.

i attach a file to demonstrate the problem.

Attachments

TestThrow.hs Download (1.3 KB) - added by andrewufrank 3 years ago.
example code

Change History

Changed 3 years ago by andrewufrank

example code

Changed 3 years ago by igloo

  • description modified (diff)

Changed 3 years ago by igloo

  • status changed from new to closed
  • resolution set to wontfix

I think every use of throw would be warned about if we did this. It sounds like you want Control.Exception.throwIO instead.

Note: See TracTickets for help on using tickets.