https://github.com/shader-slang/slang
Revision e71e75ab96fab6897f445c96a1de67e528676955 authored by Tim Foley on 24 March 2020, 21:04:30 UTC, committed by GitHub on 24 March 2020, 21:04:30 UTC
These are steps towards a fix for the problem of not being able to call a static method as follows:

    SomeType::someMethod();

One problem in the above is that the parser gets confused and parses an (anonynmous!) function declaration. This change doesn't address that problem, but *does* fix the problem that when checking fails to coerce `SomeType::someMethod` into a type it was triggering an unimplemented-feature exception rather than a real error message.

Another problem was that if the above is re-written to try to avoid the parser bug:

    (SomeType::someMethod)();

we end up with a call where the base expression (the callee) is a `ParenExpr` and the code for handling calls wasn't expecting that. Instead, it sent the overload resolution logic into an unimplemented case that was bailing by throwing an arbitrary C++ exception instead of emitting a diagnostic.

This latter issue was fixed in two ways. First, the code path that failed to emit a diagnostic now emits a reasonable one for the unimplemented feature (this still ends up being a fatal compiler error). Second, we properly handle the case of trying to call a `ParenExpr` by unwrapping it and using the base expression instead, so that `(<func>)(<args>)` is always treated the same as `<func>(<args>)`.
1 parent 7b4e0e1
History
Tip revision: e71e75ab96fab6897f445c96a1de67e528676955 authored by Tim Foley on 24 March 2020, 21:04:30 UTC
Fix some bad behavior around static methods (#1289)
Tip revision: e71e75a
File Mode Size
docs
examples
external
prelude
source
tests
tools
.editorconfig -rw-r--r-- 937 bytes
.gitattributes -rw-r--r-- 95 bytes
.gitignore -rw-r--r-- 480 bytes
.gitmodules -rw-r--r-- 774 bytes
.travis.yml -rw-r--r-- 1.7 KB
CODE_OF_CONDUCT.md -rw-r--r-- 3.1 KB
LICENSE -rw-r--r-- 1.1 KB
README.md -rw-r--r-- 7.4 KB
appveyor.yml -rw-r--r-- 4.0 KB
premake5.lua -rw-r--r-- 30.8 KB
slang-com-helper.h -rw-r--r-- 4.8 KB
slang-com-ptr.h -rw-r--r-- 4.8 KB
slang-tag-version.h -rw-r--r-- 36 bytes
slang.h -rw-r--r-- 126.9 KB
slang.sln -rw-r--r-- 10.8 KB
test.bat -rw-r--r-- 1.4 KB
travis_build.sh -rw-r--r-- 460 bytes
travis_test.sh -rw-r--r-- 435 bytes

README.md

back to top