Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(423)

Issue 204076: Review: error for type coercion of output params (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 1 month ago by larrygritz
Modified:
14 years, 1 month ago
Reviewers:
ckulla
CC:
dev-osl_imageworks.com, osl-dev_googlegroups.com
Base URL:
http://openshadinglanguage.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Ordinarily, it's fine to have type coercion on function parameters, for example, if you pass a float where a color was expected, it'll just do the usual float-to-color conversion into a temporary before using it as an argument. But this is wrong if it's an output parameter -- because if the function *writes* to that coerced temporary, well, how the heck is the result supposed to get back to the original argument, which can't even hold a color? So this proposed change catches this error and prints as clear an error message as I could muster: {{{ test.osl:11: error: Cannot pass 'float f' as argument 2 to myfunc because it is an output parameter that must be a color }}} This is related to this issue: http://code.google.com/p/openshadinglanguage/issues/detail?id=51

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+15 lines, -0 lines) Patch
src/liboslcomp/codegen.cpp View 2 chunks +15 lines, -0 lines 0 comments Download

Messages

Total messages: 2
larrygritz
14 years, 1 month ago (2010-02-08 19:57:50 UTC) #1
ckulla
14 years, 1 month ago (2010-02-08 21:15:54 UTC) #2
LGTM
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b