text:
namespace SceneEngine
{
    using namespace RenderCore;

    BufferUploads::IManager& GetBufferUploads()
    {
        return RenderCore::Assets::Services::GetBufferUploads();
    }

    SavedTargets::SavedTargets(Metal::DeviceContext& context)
    {
        _oldViewportCount = dimof(_oldViewports);
        std::fill(_oldTargets, &_oldTargets[dimof(_oldTargets)], nullptr);
        context.GetUnderlying()->OMGetRenderTargets(dimof(_oldTargets), _oldTargets, &_oldDepthTarget);
        context.GetUnderlying()->RSGetViewports(&_oldViewportCount, (D3D11_VIEWPORT*)_oldViewports);
    }

    SavedTargets::SavedTargets()
    {
        _oldViewportCount = 0;
        std::fill(_oldTargets, &_oldTargets[dimof(_oldTargets)], nullptr);
        _oldDepthTarget = nullptr;
    }

    SavedTargets::SavedTargets(SavedTargets&& moveFrom) never_throws
    {
        _oldViewportCount = moveFrom._oldViewportCount; moveFrom._oldViewportCount = 0;
        for (unsigned c=0; c<MaxSimultaneousRenderTargetCount; ++c) {
            _oldTargets[c] = moveFrom._oldTargets[c];
            _oldViewports[c] = moveFrom._oldViewports[c];
            moveFrom._oldTargets[c] = nullptr;
            moveFrom._oldViewports[c] = Metal::ViewportDesc();
        }
        _oldDepthTarget = moveFrom._oldDepthTarget; moveFrom._oldDepthTarget = nullptr;
    }

    SavedTargets& SavedTargets::operator=(SavedTargets&& moveFrom) never_throws
    {
        _oldViewportCount = moveFrom._oldViewportCount; moveFrom._oldViewportCount = 0;
        for (unsigned c=0; c<MaxSimultaneousRenderTargetCount; ++c) {
            _oldTargets[c] = moveFrom._oldTargets[c];
            _oldViewports[c] = moveFrom._oldViewports[c];
            moveFrom._oldTargets[c] = nullptr;
            moveFrom._oldViewports[c] = Metal::ViewportDesc();
        }
        _oldDepthTarget = moveFrom._oldDepthTarget; moveFrom._oldDepthTarget = nullptr;
        return *this;
    }

    SavedTargets::~SavedTargets()
    {
         for (unsigned c=0; c<dimof(_oldTargets); ++c) {
            if (_oldTargets[c]) {
                _oldTargets[c]->Release();
            }
        }
        if (_oldDepthTarget) {
            _oldDepthTarget->Release();
        }
    }

    void SavedTargets::SetDepthStencilView(ID3D::DepthStencilView* dsv)
    {
        if (_oldDepthTarget) {
            _oldDepthTarget->Release();
        }
        _oldDepthTarget = dsv;
        _oldDepthTarget->AddRef();
    }

    void        SavedTargets::ResetToOldTargets(Metal::DeviceContext& context)
    {
        context.GetUnderlying()->OMSetRenderTargets(dimof(_oldTargets), _oldTargets, _oldDepthTarget);
        context.GetUnderlying()->RSSetViewports(_oldViewportCount, (D3D11_VIEWPORT*)_oldViewports);
    }

    BufferUploads::BufferDesc BuildRenderTargetDesc(
        BufferUploads::BindFlag::BitField bindFlags,
        const BufferUploads::TextureDesc& textureDesc,
        const char name[])
    {
        using namespace BufferUploads;
        return CreateDesc(
            bindFlags, 0, GPUAccess::Read|GPUAccess::Write,
            textureDesc, name);
    }

    void SetupVertexGeneratorShader(Metal::DeviceContext& context)
    {
        context.Bind(Metal::Topology::TriangleStrip);
        context.Unbind<Metal::VertexBuffer>();
        context.Unbind<Metal::BoundInputLayout>();
    }

    void BuildGaussianFilteringWeights(float result[], float standardDeviation, unsigned weightsCount)
    {
            //      Interesting experiment with gaussian blur standard deviation values here:
            //          http://theinstructionlimit.com/tag/gaussian-blur
        float total = 0.f;
        for (int c=0; c<int(weightsCount); ++c) {
            const int centre = weightsCount / 2;
            unsigned xb = XlAbs(centre - c);
            result[c] = std::exp(-float(xb * xb) / (2.f * standardDeviation * standardDeviation));
            total += result[c];
        }
            //  have to balance the weights so they add up to one -- otherwise
            //  the final result will be too bright/dark
        for (unsigned c=0; c<weightsCount; ++c) {
            result[c] /= total;
        }
    }

    float PowerForHalfRadius(float halfRadius, float powerFraction)
    {
        const float attenuationScalar = 1.f;
        return (attenuationScalar*(halfRadius*halfRadius)+1.f) * (1.0f / (1.f-powerFraction));
    }

    ResourcePtr CreateResourceImmediate(const BufferUploads::BufferDesc& desc)
    {
        return GetBufferUploads().Transaction_Immediate(desc)->AdoptUnderlying();
    }

    template<int Count>
        class UCS4Buffer
        {
        public:
            ucs4 _buffer[Count];
            UCS4Buffer(const char input[])
            {
                utf8_2_ucs4((const utf8*)input, XlStringLen(input), _buffer, dimof(_buffer)-1);
            }
            UCS4Buffer(const char* start, const char* end)
            {
                utf8_2_ucs4((const utf8*)start, end-start, _buffer, dimof(_buffer)-1);
            }
            UCS4Buffer(const std::string& input)
            {
                utf8_2_ucs4((const utf8*)input.c_str(), input.size(), _buffer, dimof(_buffer)-1);
            }

            operator const ucs4*() const { return _buffer; }
        };

    void DrawPendingResources(
        Metal::DeviceContext* context,
        SceneEngine::LightingParserContext& parserContext,
        RenderOverlays::Font* font)
    {
        if (    !parserContext._stringHelpers->_pendingAssets[0]
            &&  !parserContext._stringHelpers->_invalidAssets[0]
            &&  !parserContext._stringHelpers->_errorString[0])
            return;

        context->Bind(Techniques::CommonResources()._blendStraightAlpha);

        using namespace RenderOverlays;
        TextStyle   style(*font);
        Float2 textPosition(16.f, 16.f);
        float lineHeight = font->LineHeight();
        const UiAlign alignment = UIALIGN_TOP_LEFT;
        const unsigned colour = 0xff7f7f7fu;

        if (parserContext._stringHelpers->_pendingAssets[0]) {
            UCS4Buffer<64> text("Pending assets:");
            Float2 alignedPosition = style.AlignText(Quad::MinMax(textPosition, Float2(1024.f, 1024.f)), alignment, text);
            style.Draw(
                context, alignedPosition[0], alignedPosition[1], text, -1,
                0.f, 1.f, 0.f, 0.f, 0xffff7f7f, UI_TEXT_STATE_NORMAL, true, nullptr);
            textPosition[1] += lineHeight;

            auto i = parserContext._stringHelpers->_pendingAssets;
            for (;;) {
                while (*i && *i == ',') ++i;
                auto* start = i;
                while (*i && *i != ',') ++i;
                if (start == i) break;

                UCS4Buffer<256> text2(start, i);
                Float2 alignedPosition = style.AlignText(Quad::MinMax(textPosition + Float2(32.f, 0.f), Float2(1024.f, 1024.f)), alignment, text2);
                style.Draw(
                    context, alignedPosition[0], alignedPosition[1], text2, -1,
                    0.f, 1.f, 0.f, 0.f, colour, UI_TEXT_STATE_NORMAL, true, nullptr);
                textPosition[1] += lineHeight;
            }
        }

        if (parserContext._stringHelpers->_invalidAssets[0]) {
            UCS4Buffer<64> text("Invalid assets:");
            Float2 alignedPosition = style.AlignText(Quad::MinMax(textPosition, Float2(1024.f, 1024.f)), alignment, text);
            style.Draw(
                context, alignedPosition[0], alignedPosition[1], text, -1,
                0.f, 1.f, 0.f, 0.f, colour, UI_TEXT_STATE_NORMAL, true, nullptr);
            textPosition[1] += lineHeight;

            auto i = parserContext._stringHelpers->_invalidAssets;
            for (;;) {
                while (*i && *i == ',') ++i;
                auto* start = i;
                while (*i && *i != ',') ++i;
                if (start == i) break;

                UCS4Buffer<256> text2(start, i);
                Float2 alignedPosition = style.AlignText(Quad::MinMax(textPosition + Float2(32.f, 0.f), Float2(1024.f, 1024.f)), alignment, text2);
                style.Draw(
                    context, alignedPosition[0], alignedPosition[1], text2, -1,
                    0.f, 1.f, 0.f, 0.f, colour, UI_TEXT_STATE_NORMAL, true, nullptr);
                textPosition[1] += lineHeight;
            }
        }

        if (parserContext._stringHelpers->_errorString[0]) {
            auto i = parserContext._stringHelpers->_errorString;
            for (;;) {
                while (*i && (*i == '\n' || *i == '\r')) ++i;
                auto* start = i;
                while (*i && *i != '\n' && *i != '\r') ++i;
                if (start == i) break;

                UCS4Buffer<512> text2(start, i);
                Float2 alignedPosition = style.AlignText(Quad::MinMax(textPosition, Float2(1024.f, 1024.f)), alignment, text2);
                style.Draw(
                    context, alignedPosition[0], alignedPosition[1], text2, -1,
                    0.f, 1.f, 0.f, 0.f, colour, UI_TEXT_STATE_NORMAL, true, nullptr);
                textPosition[1] += lineHeight;
            }
        }
    }

    void DrawQuickMetrics(
        Metal::DeviceContext* context,
        SceneEngine::LightingParserContext& parserContext,
        RenderOverlays::Font* font)
    {
        if (parserContext._stringHelpers->_quickMetrics[0]) {
            context->Bind(Techniques::CommonResources()._blendStraightAlpha);

            using namespace RenderOverlays;
            TextStyle style(*font);
            Float2 textPosition(16.f, 150.f);
            float lineHeight = font->LineHeight();
            const UiAlign alignment = UIALIGN_TOP_LEFT;
            const unsigned colour = 0xffcfcfcfu;

            auto i = parserContext._stringHelpers->_quickMetrics;
            for (;;) {
                while (*i && (*i == '\n' || *i == '\r')) ++i;
                auto* start = i;
                while (*i && *i != '\n' && *i != '\r') ++i;
                if (start == i) break;

                UCS4Buffer<512> text2(start, i);
                Float2 alignedPosition = style.AlignText(Quad::MinMax(textPosition, Float2(1024.f, 1024.f)), alignment, text2);
                style.Draw(
                    context, alignedPosition[0], alignedPosition[1], text2, -1,
                    0.f, 1.f, 0.f, 0.f, colour, UI_TEXT_STATE_NORMAL, true, nullptr);
                textPosition[1] += lineHeight;
            }
        }
    }

///////////////////////////////////////////////////////////////////////////////////////////////////

    Int2 GetCursorPos()
    {
        POINT cursorPos;
        GetCursorPos(&cursorPos);
        ScreenToClient((HWND)::GetActiveWindow(), &cursorPos);
        return Int2(cursorPos.x, cursorPos.y);
    }

    bool IsLButtonDown() { return GetKeyState(VK_LBUTTON)<0; }
    bool IsShiftDown() { return GetKeyState(VK_LSHIFT)<0; }

    void CheckSpecularIBLMipMapCount(const RenderCore::Metal::ShaderResourceView& srv)
    {
        // Specular ibl textures must always have 10 mipmaps. This value is hardcoded in
        // the shader code.
        // 9 mipmaps corresponds to a cubemap with 512x512 faces.
        // #if defined(_DEBUG)
        //     Metal::TextureDesc2D desc(srv.GetUnderlying());
        //     assert(desc.ArraySize == 6);
        //     assert(desc.MipLevels == 10);
        // #endif
    }

///////////////////////////////////////////////////////////////////////////////////////////////////

    IteratorRange<RenderCore::Assets::DelayStep*> AsDelaySteps(
        SceneParseSettings::BatchFilter filter)
    {
        using BF = SceneEngine::SceneParseSettings::BatchFilter;
        using V = std::vector<RenderCore::Assets::DelayStep>;
        using DelayStep = RenderCore::Assets::DelayStep;

        switch (filter) {
        case BF::General:
        case BF::PreDepth:
            {
                static DelayStep result[] { DelayStep::OpaqueRender };
                return MakeIteratorRange(result);
            }

        case BF::Transparent:
            {
                static DelayStep result[] { DelayStep::PostDeferred };
                return MakeIteratorRange(result);
            }

        case BF::TransparentPreDepth:
            {
                static DelayStep result[] { DelayStep::PostDeferred, DelayStep::SortedBlending };
                return MakeIteratorRange(result);
            }

        case BF::OITransparent:
            {
                static DelayStep result[] { DelayStep::SortedBlending };
                return MakeIteratorRange(result);
            }

        case BF::DMShadows:
        case BF::RayTracedShadows:
            {
                static DelayStep result[] { DelayStep::OpaqueRender, DelayStep::PostDeferred, DelayStep::SortedBlending };
                return MakeIteratorRange(result);
            }
        }

        return IteratorRange<RenderCore::Assets::DelayStep*>();
    }

///////////////////////////////////////////////////////////////////////////////////////////////////

    ProtectState::ProtectState(Metal::DeviceContext& context, States::BitField states)
    : _context(&context), _states(states)
    {
        if (_states & States::RenderTargets || _states & States::Viewports)
            _targets = SavedTargets(context);
        if (_states & States::DepthStencilState)
            _depthStencilState = Metal::DepthStencilState(context);
        if (_states & States::BlendState) {
            ID3D::BlendState* rawptr = nullptr;
            context.GetUnderlying()->OMGetBlendState(&rawptr, _blendFactor, &_blendSampleMask);
            _blendState = moveptr(rawptr);
        }
        if (_states & States::RasterizerState)
            _rasterizerState = Metal::RasterizerState(context);
        if (_states & States::InputLayout)
            _inputLayout = Metal::BoundInputLayout(context);

        if (_states & States::VertexBuffer) {
            ID3D::Buffer* rawptrs[s_vbCount];
            context.GetUnderlying()->IAGetVertexBuffers(0, s_vbCount, rawptrs, _vbStrides, _vbOffsets);
            for (unsigned c=0; c<s_vbCount; ++c)
                _vertexBuffers[c] = moveptr(rawptrs[c]);
        }

        if (_states & States::IndexBuffer) {
            ID3D::Buffer* rawptr = nullptr;
            context.GetUnderlying()->IAGetIndexBuffer(&rawptr, (DXGI_FORMAT*)&_ibFormat, &_ibOffset);
            _indexBuffer = moveptr(rawptr);
        }

        if (_states & States::Topology) {
            context.GetUnderlying()->IAGetPrimitiveTopology((D3D11_PRIMITIVE_TOPOLOGY*)&_topology);
        }
    }

    ProtectState::ProtectState()
    {
        _context = nullptr;
        _states = 0;
        _ibFormat = DXGI_FORMAT_UNKNOWN;
        _ibOffset = 0;
        _topology = (D3D11_PRIMITIVE_TOPOLOGY)0;
    }

    ProtectState::ProtectState(ProtectState&& moveFrom)
    : _targets(std::move(moveFrom._targets))
    , _depthStencilState(std::move(moveFrom._depthStencilState))
    , _inputLayout(std::move(moveFrom._inputLayout))
    , _indexBuffer(std::move(moveFrom._indexBuffer))
    , _blendState(std::move(moveFrom._blendState))
    , _rasterizerState(std::move(moveFrom._rasterizerState))
    {
        _context = moveFrom._context; moveFrom._context = nullptr;
        _states = moveFrom._states; moveFrom._states = 0;

        _ibFormat = moveFrom._ibFormat;
        _ibOffset = moveFrom._ibOffset;

        for (unsigned s=0; s<s_vbCount; ++s) {
            _vertexBuffers[s] = std::move(moveFrom._vertexBuffers[s]);
            _vbStrides[s] = moveFrom._vbStrides[s];
            _vbOffsets[s] = moveFrom._vbOffsets[s];
        }

        for (unsigned c=0; c<4; ++c)
            _blendFactor[c] = moveFrom._blendFactor[c];
        _blendSampleMask = moveFrom._blendSampleMask;

        _viewports = moveFrom._viewports;
        _topology = moveFrom._topology;
    }

    ProtectState& ProtectState::operator=(ProtectState&& moveFrom)
    {
        _context = moveFrom._context; moveFrom._context = nullptr;
        _targets = std::move(moveFrom._targets);
        _states = moveFrom._states; moveFrom._states = 0;

        _depthStencilState = std::move(moveFrom._depthStencilState);
        _inputLayout = std::move(moveFrom._inputLayout);

        _indexBuffer = std::move(moveFrom._indexBuffer);
        _ibFormat = moveFrom._ibFormat;
        _ibOffset = moveFrom._ibOffset;

        for (unsigned s=0; s<s_vbCount; ++s) {
            _vertexBuffers[s] = std::move(moveFrom._vertexBuffers[s]);
            _vbStrides[s] = moveFrom._vbStrides[s];
            _vbOffsets[s] = moveFrom._vbOffsets[s];
        }

        _blendState = std::move(moveFrom._blendState);
        for (unsigned c=0; c<4; ++c)
            _blendFactor[c] = moveFrom._blendFactor[c];
        _blendSampleMask = moveFrom._blendSampleMask;

        _rasterizerState = std::move(moveFrom._rasterizerState);

        _viewports = moveFrom._viewports;
        _topology = moveFrom._topology;
        return *this;
    }

    void ProtectState::ResetStates()
    {
        if (_context) {
            if (_states & States::RenderTargets|| _states & States::Viewports)
                _targets.ResetToOldTargets(*_context);
            if (_states & States::DepthStencilState)
                _context->Bind(_depthStencilState);
            if (_states & States::BlendState)
                _context->GetUnderlying()->OMSetBlendState(_blendState.get(), _blendFactor, _blendSampleMask);
            if (_states & States::RasterizerState)
                _context->Bind(_rasterizerState);
            if (_states & States::InputLayout)
                _context->Bind(_inputLayout);

            if (_states & States::VertexBuffer) {
                ID3D::Buffer* rawptrs[s_vbCount];
                for (unsigned c=0; c<s_vbCount; ++c)
                    rawptrs[c] = _vertexBuffers[c].get();
                _context->GetUnderlying()->IASetVertexBuffers(0, s_vbCount, rawptrs, _vbStrides, _vbOffsets);
            }

            if (_states & States::IndexBuffer)
                _context->GetUnderlying()->IASetIndexBuffer(_indexBuffer.get(), (DXGI_FORMAT)_ibFormat, _ibOffset);
            if (_states & States::Topology)
                _context->GetUnderlying()->IASetPrimitiveTopology((D3D11_PRIMITIVE_TOPOLOGY)_topology);

            _states = 0;
        }
    }

    ProtectState::~ProtectState()
    {
        ResetStates();
    }

///////////////////////////////////////////////////////////////////////////////////////////////////

    void ShaderBasedCopy(
        Metal::DeviceContext& context,
        const Metal::DepthStencilView& dest,
        const Metal::ShaderResourceView& src,
        ProtectState::States::BitField protectStates)
    {
        using States = ProtectState::States;
        const States::BitField effectedStates =
            States::RenderTargets | States::Viewports | States::DepthStencilState
            | States::Topology | States::InputLayout | States::VertexBuffer
            ;
        ProtectState savedStates(context, effectedStates & protectStates);

        Metal::TextureDesc2D desc(dest.GetUnderlying());
        context.Bind(Metal::ViewportDesc(0.f, 0.f, float(desc.Width), float(desc.Height)));

        context.Bind(ResourceList<Metal::RenderTargetView, 0>(), &dest);
        context.Bind(Techniques::CommonResources()._dssWriteOnly);
        context.Bind(
            ::Assets::GetAssetDep<Metal::ShaderProgram>(
                "game/xleres/basic2d.vsh:fullscreen:vs_*",
                "game/xleres/basic.psh:copy_depth:ps_*"));
        context.BindPS(MakeResourceList(src));
        SetupVertexGeneratorShader(context);
        context.Draw(4);
        context.UnbindPS<Metal::ShaderResourceView>(0, 1);
    }

    class ShaderBasedCopyRes
    {
    public:
        class Desc
        {
        public:
            CopyFilter _filter;
            Desc(CopyFilter filter) : _filter(filter) {}
        };

        const Metal::ShaderProgram* _shader;
        Metal::BoundUniforms _uniforms;

        ShaderBasedCopyRes(const Desc& desc)
        {
            switch (desc._filter) {
            case CopyFilter::BoxFilter:
                    // The box filter is designed for generating
                    // mip-maps. And it can work even when building
                    // very small mip-maps from the top-most level.
                    // It will sample all of the pixels in
                    // the source (unlike bilinear filter, which will
                    // only sample some pixels in large downsampling
                    // operations)
                _shader = &::Assets::GetAssetDep<Metal::ShaderProgram>(
                    "game/xleres/basic2d.vsh:screenspacerect:vs_*",
                    "game/xleres/basic.psh:copy_boxfilter:ps_*");
                break;

            case CopyFilter::BoxFilterAlphaComplementWeight:
                _shader = &::Assets::GetAssetDep<Metal::ShaderProgram>(
                    "game/xleres/basic2d.vsh:screenspacerect:vs_*",
                    "game/xleres/basic.psh:copy_boxfilter_alphacomplementweight:ps_*");
                break;

            default:
                _shader = &::Assets::GetAssetDep<Metal::ShaderProgram>(
                    "game/xleres/basic2d.vsh:screenspacerect:vs_*",
                    "game/xleres/basic.psh:copy_bilinear:ps_*");
                break;
            }
            _uniforms = Metal::BoundUniforms(*_shader);
            _uniforms.BindConstantBuffers(1, {"ScreenSpaceOutput"});

            _validationCallback = _shader->GetDependencyValidation();
        }

        ~ShaderBasedCopyRes() {}

        const std::shared_ptr<::Assets::DependencyValidation>& GetDependencyValidation() const
            { return _validationCallback; }

    private:
        std::shared_ptr<::Assets::DependencyValidation>   _validationCallback;
    };

    void ShaderBasedCopy(
        Metal::DeviceContext& context,
        const RenderCore::Metal::RenderTargetView& dest,
        const RenderCore::Metal::ShaderResourceView& src,
        std::pair<UInt2, UInt2> destination,
        std::pair<UInt2, UInt2> source,
        CopyFilter filter, ProtectState::States::BitField protectStates)
    {
        using States = ProtectState::States;
        const States::BitField effectedStates =
            States::RenderTargets | States::Viewports | States::DepthStencilState
            | States::Topology | States::InputLayout | States::VertexBuffer
            ;
        ProtectState savedStates(context, effectedStates & protectStates);

        auto& res = Techniques::FindCachedBoxDep2<ShaderBasedCopyRes>(filter);

        Metal::TextureDesc2D desc(dest.GetUnderlying());
        context.Bind(Metal::ViewportDesc(0.f, 0.f, float(desc.Width), float(desc.Height)));

        Metal::TextureDesc2D srcDesc(src.GetUnderlying());

        Float2 coords[6] =
        {
            Float2(float(destination.first[0]), float(destination.first[1])),
            Float2(float(destination.second[0]), float(destination.second[1])),
            Float2(source.first[0] / float(srcDesc.Width), source.first[1] / float(srcDesc.Height)),
            Float2(source.second[0] / float(srcDesc.Width), source.second[1] / float(srcDesc.Height)),
            Float2(float(desc.Width), float(desc.Height)),
            Zero<Float2>()
        };

        context.Bind(MakeResourceList(dest), nullptr);
        context.Bind(Techniques::CommonResources()._dssWriteOnly);
        context.Bind(*res._shader);
        res._uniforms.Apply(
            context, Metal::UniformsStream(),
            Metal::UniformsStream({MakeSharedPkt(coords)}, {}));
        context.BindPS(MakeResourceList(src));
        SetupVertexGeneratorShader(context);
        context.Draw(4);
        context.UnbindPS<Metal::ShaderResourceView>(0, 1);
    }

}


text:
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.VisualBasic.CodeFixes.RemoveUnnecessaryCast
Imports Microsoft.CodeAnalysis.VisualBasic.Diagnostics.RemoveUnnecessaryCast

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.RemoveUnnecessaryCast
    Partial Public Class RemoveUnnecessaryCastTests
        Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest

        <WpfFact>
        <Trait(Traits.Feature, Traits.Features.CodeActionsSimplifyTypeNames)>
        <Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
        Public Sub TestFixAllInDocument()
            Dim input = <Workspace>
                            <Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
                                <Document><![CDATA[
Imports System
Class Program
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = {|FixAllInDocument:CInt(0)|}
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))

        Dim prog = New Program
        Dim x = ((DirectCast(Prog, Program)).F)
        Dim x2 = ((DirectCast(Prog, Program)).F)
    End Sub
End Class]]>
                                </Document>
                                <Document><![CDATA[
Imports System
Class Program2
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = CInt(0)
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))

        Dim prog = New Program
        Dim x = ((DirectCast(Prog, Program)).F)
        Dim x2 = ((DirectCast(Prog, Program)).F)
    End Sub
End Class]]>
                                </Document>
                            </Project>
                            <Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
                                <ProjectReference>Assembly1</ProjectReference>
                                <Document><![CDATA[
Imports System
Class Program3
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = CInt(0)
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))

        Dim prog = New Program
        Dim x = ((DirectCast(Prog, Program)).F)
        Dim x2 = ((DirectCast(Prog, Program)).F)
    End Sub
End Class]]>
                                </Document>
                            </Project>
                        </Workspace>.ToString()

            Dim expected = <Workspace>
                               <Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
                                   <Document><![CDATA[
Imports System
Class Program
    Private f As Char = "c"C
    Public Sub F(Optional x As Integer = 0)
        ' unnecessary casts
        Dim y As Integer = 0
        Dim z As Boolean = True

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = CObj(If(z, s1, s2))

        Dim prog = New Program
        Dim x = ((Prog).F)
        Dim x2 = ((Prog).F)
    End Sub
End Class]]>
                                   </Document>
                                   <Document><![CDATA[
Imports System
Class Program2
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = CInt(0)
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))

        Dim prog = New Program
        Dim x = ((DirectCast(Prog, Program)).F)
        Dim x2 = ((DirectCast(Prog, Program)).F)
    End Sub
End Class]]>
                                   </Document>
                               </Project>
                               <Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
                                   <ProjectReference>Assembly1</ProjectReference>
                                   <Document><![CDATA[
Imports System
Class Program3
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = CInt(0)
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))

        Dim prog = New Program
        Dim x = ((DirectCast(Prog, Program)).F)
        Dim x2 = ((DirectCast(Prog, Program)).F)
    End Sub
End Class]]>
                                   </Document>
                               </Project>
                           </Workspace>.ToString()

            Test(input, expected, compareTokens:=False, fixAllActionEquivalenceKey:=Nothing)
        End Sub

        <WpfFact>
        <Trait(Traits.Feature, Traits.Features.CodeActionsSimplifyTypeNames)>
        <Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
        Public Sub TestFixAllInProject()
            Dim input = <Workspace>
                            <Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
                                <Document><![CDATA[
Imports System
Class Program
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = {|FixAllInProject:CInt(0)|}
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
    End Sub
End Class]]>
                                </Document>
                                <Document><![CDATA[
Imports System
Class Program2
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = CInt(0)
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
    End Sub
End Class]]>
                                </Document>
                            </Project>
                            <Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
                                <ProjectReference>Assembly1</ProjectReference>
                                <Document><![CDATA[
Imports System
Class Program3
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = CInt(0)
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
    End Sub
End Class]]>
                                </Document>
                            </Project>
                        </Workspace>.ToString()

            Dim expected = <Workspace>
                               <Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
                                   <Document><![CDATA[
Imports System
Class Program
    Private f As Char = "c"C
    Public Sub F(Optional x As Integer = 0)
        ' unnecessary casts
        Dim y As Integer = 0
        Dim z As Boolean = True

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = CObj(If(z, s1, s2))
    End Sub
End Class]]>
                                   </Document>
                                   <Document><![CDATA[
Imports System
Class Program2
    Private f As Char = "c"C
    Public Sub F(Optional x As Integer = 0)
        ' unnecessary casts
        Dim y As Integer = 0
        Dim z As Boolean = True

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = CObj(If(z, s1, s2))
    End Sub
End Class]]>
                                   </Document>
                               </Project>
                               <Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
                                   <ProjectReference>Assembly1</ProjectReference>
                                   <Document><![CDATA[
Imports System
Class Program3
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = CInt(0)
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
    End Sub
End Class]]>
                                   </Document>
                               </Project>
                           </Workspace>.ToString()

            Test(input, expected, compareTokens:=False, fixAllActionEquivalenceKey:=Nothing)
        End Sub

        <WpfFact>
        <Trait(Traits.Feature, Traits.Features.CodeActionsSimplifyTypeNames)>
        <Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
        Public Sub TestFixAllInSolution()
            Dim input = <Workspace>
                            <Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
                                <Document><![CDATA[
Imports System
Class Program
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = {|FixAllInSolution:CInt(0)|}
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
    End Sub
End Class]]>
                                </Document>
                                <Document><![CDATA[
Imports System
Class Program2
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = CInt(0)
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
    End Sub
End Class]]>
                                </Document>
                            </Project>
                            <Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
                                <ProjectReference>Assembly1</ProjectReference>
                                <Document><![CDATA[
Imports System
Class Program3
    Private f As Char = CChar("c"C)
    Public Sub F(Optional x As Integer = CInt(0))
        ' unnecessary casts
        Dim y As Integer = CInt(0)
        Dim z As Boolean = CBool(True)

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
    End Sub
End Class]]>
                                </Document>
                            </Project>
                        </Workspace>.ToString()

            Dim expected = <Workspace>
                               <Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
                                   <Document><![CDATA[
Imports System
Class Program
    Private f As Char = "c"C
    Public Sub F(Optional x As Integer = 0)
        ' unnecessary casts
        Dim y As Integer = 0
        Dim z As Boolean = True

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = CObj(If(z, s1, s2))
    End Sub
End Class]]>
                                   </Document>
                                   <Document><![CDATA[
Imports System
Class Program2
    Private f As Char = "c"C
    Public Sub F(Optional x As Integer = 0)
        ' unnecessary casts
        Dim y As Integer = 0
        Dim z As Boolean = True

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = CObj(If(z, s1, s2))
    End Sub
End Class]]>
                                   </Document>
                               </Project>
                               <Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
                                   <ProjectReference>Assembly1</ProjectReference>
                                   <Document><![CDATA[
Imports System
Class Program3
    Private f As Char = "c"C
    Public Sub F(Optional x As Integer = 0)
        ' unnecessary casts
        Dim y As Integer = 0
        Dim z As Boolean = True

        ' required cast
        Dim l As Long = 1
        Dim ll = CInt(l)

        ' required cast after cast removal in same statement
        Dim s1 As String = Nothing, s2 As String = Nothing
        Dim s3 = CObj(If(z, s1, s2))
    End Sub
End Class]]>
                                   </Document>
                               </Project>
                           </Workspace>.ToString()

            Test(input, expected, compareTokens:=False, fixAllActionEquivalenceKey:=Nothing)
        End Sub
    End Class
End Namespace

redpajama_set_name: RedPajamaGithub


text:
RSpec.describe FeaturedWorkList, type: :model do
  let(:work1) { create(:generic_work) }
  let(:work2) { create(:generic_work) }

  describe 'featured_works' do
    before do
      create(:featured_work, work_id: work1.id)
      create(:featured_work, work_id: work2.id)
    end

    it 'is a list of the featured work objects, each with the generic_work\'s solr_doc' do
      presenter_ids = subject.featured_works.map { |fw| fw.presenter.id }
      expect(presenter_ids).to contain_exactly(work1.id, work2.id)
      subject.featured_works.each do |fw|
        expect(fw.presenter).to be_kind_of Hyrax::WorkShowPresenter
      end
    end

    context 'when one of the files is deleted' do
      before do
        work1.destroy
      end

      it 'is a list of the remaining featured work objects, each with the generic_work\'s solr_doc' do
        expect(subject.featured_works.size).to eq 1
        presenter = subject.featured_works.first.presenter
        expect(presenter).to be_kind_of Hyrax::WorkShowPresenter
        expect(presenter.id).to eq work2.id
      end
    end
  end

  describe '#featured_works_attributes=' do
    # We don't need to persist the given work. This saves a few LDP calls.
    let(:work_id) { 'no-need-to-persist' }
    let(:featured_work) { create(:featured_work, work_id: work_id) }

    let(:attributes) do
      ActionController::Parameters.new(
        "0" => {
          "id" => featured_work.id,
          "order" => "5"
        }
      ).permit!
    end
    let(:instance) { described_class.new }

    subject { instance.featured_works_attributes = attributes }

    it "sets order" do
      subject
      expect(featured_work.order).to eq 5
    end
  end

  it { is_expected.to delegate_method(:empty?).to(:featured_works) }
end


text:
#if defined(BFLB_BLE)
#include "addr.h"
#endif

/* Max settings key length (with all components) */
#define BT_SETTINGS_KEY_MAX 36

/* Base64-encoded string buffer size of in_size bytes */
#define BT_SETTINGS_SIZE(in_size) ((((((in_size) - 1) / 3) * 4) + 4) + 1)

/* Helpers for keys containing a bdaddr */
void bt_settings_encode_key(char *path, size_t path_size, const char *subsys,
			    bt_addr_le_t *addr, const char *key);
int bt_settings_decode_key(const char *key, bt_addr_le_t *addr);

void bt_settings_save_id(void);

int bt_settings_init(void);

#if defined(BFLB_BLE)
#define NV_LOCAL_NAME      "LOCAL_NAME"
#define NV_LOCAL_ID_ADDR   "LOCAL_ID_ADDR"
#define NV_LOCAL_IRK       "LOCAL_IRK"
#define NV_KEY_POOL        "KEY_POOL"
#define NV_IMG_info        "IMG_INFO"

int bt_settings_get_bin(const char *key, u8_t *value, size_t exp_len, size_t *real_len);
int bt_settings_set_bin(const char *key, const u8_t *value, size_t length);
int settings_delete(const char *key);
int settings_save_one(const char *key, const u8_t *value, size_t length);
void bt_settings_save_name(void);
void bt_local_info_load(void);
#endif


text:
@brief removes documents matching an example
`collection.removeByExample(example)`

Removes all documents matching an example.

`collection.removeByExample(document, waitForSync)`

The optional *waitForSync* parameter can be used to force synchronization
of the document deletion operation to disk even in case that the
*waitForSync* flag had been disabled for the entire collection.  Thus,
the *waitForSync* parameter can be used to force synchronization of just
specific operations. To use this, set the *waitForSync* parameter to
*true*. If the *waitForSync* parameter is not specified or set to
*false*, then the collection's default *waitForSync* behavior is
applied. The *waitForSync* parameter cannot be used to disable
synchronization for collections that have a default *waitForSync* value
of *true*.

`collection.removeByExample(document, waitForSync, limit)`

The optional *limit* parameter can be used to restrict the number of
removals to the specified value. If *limit* is specified but less than the
number of documents in the collection, it is undefined which documents are
removed.

@EXAMPLES

@EXAMPLE_ARANGOSH_OUTPUT{010_documentsCollectionRemoveByExample}
~ db._create("example");
~ db.example.save({ Hello : "world" });
  db.example.removeByExample( {Hello : "world"} );
~ db._drop("example");
@END_EXAMPLE_ARANGOSH_OUTPUT


text:
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyApi.Client;
using EasyApi.Client.Proxies;
using EasyApi.Metadata;
using EasyApi.Tests.TestUtils;
using EasyApi.Utils;
using NSubstitute;
using NUnit.Framework;
using static EasyApi.Tests.TestUtils.MetadataProviderHelpers;
using static EasyApi.Tests.TestUtils.SubstituteHelpers;

namespace EasyApi.Tests.Client.Proxies
{
	[TestFixture]
	[TestOf(typeof(ServiceProxyExtensions))]
	[Parallelizable]
	public class ServiceProxyExtensionsTests
	{
		private static readonly Uri _uri = new Uri("http://www.example.com");

		private readonly ServiceMetadata _serviceMetadata;
		private readonly IServiceProxyFactory _proxyFactory;

		public ServiceProxyExtensionsTests()
		{
			_serviceMetadata = (ServiceMetadata)MetadataProvider(DefaultMetadataReaders()).GetMetadata(typeof(ITestService));

			var clientFactory = Substitute<IServiceClientFactory>().Setup(
				cf => cf.CreateClient(Arg.Any<Type>(), Arg.Any<ServiceClientSettings>())
						.Returns(ctx => Substitute<IServiceClient>().Setup(c => c.ServiceMetadata.Returns(_serviceMetadata)))
			);

			_proxyFactory = new ServiceProxyFactory(clientFactory);
		}

		private IServiceProxy<ITestService> CreateProxy()
		{
			return (IServiceProxy<ITestService>)_proxyFactory.CreateProxy(typeof(ITestService), new ServiceClientSettings(_uri));
		}

		private ActionMetadata GetActionMetadata(string methodName)
		{
			return _serviceMetadata.Actions.Find(_serviceMetadata.ReflectedType.GetMethod(methodName));
		}

		#region Execute Action

		[Test]
		public void Execute_Action_NullService_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).Execute(s => s.Action()));
		}

		[Test]
		public void Execute_Action_NullAction_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => CreateProxy().Execute((Action<ITestService>)null));
		}

		[Test]
		public void Execute_Action_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(() => CreateProxy().Execute(s => { }));
		}

		[Test]
		public void Execute_Action_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().Execute(
					s =>
					{
						s.Action();
						s.Action();
					}
				)
			);
		}

		[Test]
		public void Execute_Action_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			proxy.Execute(s => s.Action(15));

			proxy.Client.Received(1).Execute(
				GetActionMetadata(nameof(ITestService.Action)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);
		}

		#endregion Execute Action

		#region Execute ActionAsync

		[Test]
		public void Execute_ActionAsync_NullService_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).Execute(s => s.ActionAsync()));
		}

		[Test]
		public void Execute_ActionAsync_NullAction_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => CreateProxy().Execute((Func<ITestService, Task>)null));
		}

		[Test]
		public void Execute_ActionAsync_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(() => CreateProxy().Execute(s => Task.CompletedTask));
		}

		[Test]
		public void Execute_ActionAsync_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().Execute(
					s =>
					{
						s.Action();
						return s.ActionAsync();
					}
				)
			);
		}

		[Test]
		public void Execute_ActionAsync_ResultChanged_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().Execute(
					async s =>
					{
						await s.ActionAsync().ConfigureAwait(false);
					}
				)
			);
		}

		[Test]
		public void Execute_ActionAsync_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			proxy.Execute(s => s.ActionAsync(15));

			proxy.Client.Received(1).Execute(
				GetActionMetadata(nameof(ITestService.ActionAsync)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);
		}

		#endregion Execute ActionAsync

		#region ExecuteAsync Action

		[Test]
		public void ExecuteAsync_Action_NullService_ThrowsArgumentNullException()
		{
			Assert.CatchAsync<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).ExecuteAsync(s => s.Action()));
		}

		[Test]
		public void ExecuteAsync_Action_NullAction_ThrowsArgumentNullException()
		{
			Assert.CatchAsync<ArgumentNullException>(() => CreateProxy().ExecuteAsync((Action<ITestService>)null));
		}

		[Test]
		public void ExecuteAsync_Action_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.CatchAsync<InvalidOperationException>(() => CreateProxy().ExecuteAsync(s => { }));
		}

		[Test]
		public void ExecuteAsync_Action_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.CatchAsync<InvalidOperationException>(
				() => CreateProxy().ExecuteAsync(
					s =>
					{
						s.Action();
						s.Action();
					}
				)
			);
		}

		[Test]
		public void ExecuteAsync_Action_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			var expectedTask = Task.Delay(1);
			proxy.Client.ExecuteAsync(Arg.Any<IActionMetadata>(), Arg.Any<object[]>()).Returns(expectedTask);

			var resultTask = proxy.ExecuteAsync(s => s.Action(15));

			proxy.Client.Received(1).ExecuteAsync(
				GetActionMetadata(nameof(ITestService.Action)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);

			Assert.AreSame(expectedTask, resultTask);
		}

		#endregion ExecuteAsync Action

		#region ExecuteAsync ActionAsync

		[Test]
		public void ExecuteAsync_ActionAsync_NullService_ThrowsArgumentNullException()
		{
			Assert.CatchAsync<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).ExecuteAsync(s => s.ActionAsync()));
		}

		[Test]
		public void ExecuteAsync_ActionAsync_NullAction_ThrowsArgumentNullException()
		{
			Assert.CatchAsync<ArgumentNullException>(() => CreateProxy().ExecuteAsync((Func<ITestService, Task>)null));
		}

		[Test]
		public void ExecuteAsync_ActionAsync_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.CatchAsync<InvalidOperationException>(() => CreateProxy().ExecuteAsync(s => Task.CompletedTask));
		}

		[Test]
		public void ExecuteAsync_ActionAsync_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.CatchAsync<InvalidOperationException>(
				() => CreateProxy().ExecuteAsync(
					s =>
					{
						s.Action();
						return s.ActionAsync();
					}
				)
			);
		}

		[Test]
		public void ExecuteAsync_ActionAsync_ResultChanged_ThrowsInvalidOperationException()
		{
			Assert.CatchAsync<InvalidOperationException>(
				() => CreateProxy().ExecuteAsync(
					async s =>
					{
						await s.ActionAsync().ConfigureAwait(false);
					}
				)
			);
		}

		[Test]
		public void ExecuteAsync_ActionAsync_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			var expectedTask = Task.Delay(1);
			proxy.Client.ExecuteAsync(Arg.Any<IActionMetadata>(), Arg.Any<object[]>()).Returns(expectedTask);

			var resultTask = proxy.ExecuteAsync(s => s.ActionAsync(15));

			proxy.Client.Received(1).ExecuteAsync(
				GetActionMetadata(nameof(ITestService.ActionAsync)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);

			Assert.AreSame(expectedTask, resultTask);
		}

		#endregion ExecuteAsync ActionAsync

		#region Execute Function

		[Test]
		public void Execute_Function_NullService_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).Execute(s => s.Function()));
		}

		[Test]
		public void Execute_Function_NullAction_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => CreateProxy().Execute((Func<ITestService, int>)null));
		}

		[Test]
		public void Execute_Function_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(() => CreateProxy().Execute(s => 12));
		}

		[Test]
		public void Execute_Function_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().Execute(
					s =>
					{
						s.Action();
						return s.Function();
					}
				)
			);
		}

		[Test]
		public void Execute_Function_ResultChanged_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().Execute(s => s.Function() + 2)
			);
		}

		[Test]
		public void Execute_Function_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			proxy.Client.Execute<int>(Arg.Any<IActionMetadata>(), Arg.Any<object[]>()).Returns(42);

			var result = proxy.Execute(s => s.Function(15));

			proxy.Client.Received(1).Execute<int>(
				GetActionMetadata(nameof(ITestService.Function)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);

			Assert.AreEqual(42, result);
		}

		#endregion Execute Function

		#region Execute FunctionAsync

		[Test]
		public void Execute_FunctionAsync_NullService_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).Execute(s => s.FunctionAsync()));
		}

		[Test]
		public void Execute_FunctionAsync_NullAction_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => CreateProxy().Execute((Func<ITestService, Task<int>>)null));
		}

		[Test]
		public void Execute_FunctionAsync_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(() => CreateProxy().Execute(s => Task.FromResult(12)));
		}

		[Test]
		public void Execute_FunctionAsync_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().Execute(
					s =>
					{
						s.Action();
						return s.FunctionAsync();
					}
				)
			);
		}

		[Test]
		public void Execute_FunctionAsync_ResultChanged_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().Execute(async s => await s.FunctionAsync() + 2)
			);
		}

		[Test]
		public void Execute_FunctionAsync_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			proxy.Client.Execute<int>(Arg.Any<IActionMetadata>(), Arg.Any<object[]>()).Returns(42);

			var result = proxy.Execute(s => s.FunctionAsync(15));

			proxy.Client.Received(1).Execute<int>(
				GetActionMetadata(nameof(ITestService.FunctionAsync)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);

			Assert.AreEqual(42, result);
		}

		#endregion Execute FunctionAsync

		#region ExecuteAsync Function

		[Test]
		public void ExecuteAsync_Function_NullService_ThrowsArgumentNullException()
		{
			Assert.CatchAsync<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).ExecuteAsync(s => s.Function()));
		}

		[Test]
		public void ExecuteAsync_Function_NullAction_ThrowsArgumentNullException()
		{
			Assert.CatchAsync<ArgumentNullException>(() => CreateProxy().ExecuteAsync((Func<ITestService, int>)null));
		}

		[Test]
		public void ExecuteAsync_Function_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.CatchAsync<InvalidOperationException>(() => CreateProxy().ExecuteAsync(s => 12));
		}

		[Test]
		public void ExecuteAsync_Function_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.CatchAsync<InvalidOperationException>(
				() => CreateProxy().ExecuteAsync(
					s =>
					{
						s.Action();
						return s.Function();
					}
				)
			);
		}

		[Test]
		public void ExecuteAsync_Function_ResultChanged_ThrowsInvalidOperationException()
		{
			Assert.CatchAsync<InvalidOperationException>(
				() => CreateProxy().ExecuteAsync(s => s.Function() + 2)
			);
		}

		[Test]
		public void ExecuteAsync_Function_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			var expectedResult = Task.FromResult(42);
			proxy.Client.ExecuteAsync<int>(Arg.Any<IActionMetadata>(), Arg.Any<object[]>()).Returns(expectedResult);

			var result = proxy.ExecuteAsync(s => s.Function(15));

			proxy.Client.Received(1).ExecuteAsync<int>(
				GetActionMetadata(nameof(ITestService.Function)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);

			Assert.AreEqual(expectedResult, result);
		}

		#endregion ExecuteAsync Function

		#region ExecuteAsync FunctionAsync

		[Test]
		public void ExecuteAsync_FunctionAsync_NullService_ThrowsArgumentNullException()
		{
			Assert.CatchAsync<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).ExecuteAsync(s => s.FunctionAsync()));
		}

		[Test]
		public void ExecuteAsync_FunctionAsync_NullAction_ThrowsArgumentNullException()
		{
			Assert.CatchAsync<ArgumentNullException>(() => CreateProxy().ExecuteAsync((Func<ITestService, Task<int>>)null));
		}

		[Test]
		public void ExecuteAsync_FunctionAsync_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.CatchAsync<InvalidOperationException>(() => CreateProxy().ExecuteAsync(s => Task.FromResult(12)));
		}

		[Test]
		public void ExecuteAsync_FunctionAsync_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.CatchAsync<InvalidOperationException>(
				() => CreateProxy().ExecuteAsync(
					s =>
					{
						s.Action();
						return s.FunctionAsync();
					}
				)
			);
		}

		[Test]
		public void ExecuteAsync_FunctionAsync_ResultChanged_ThrowsInvalidOperationException()
		{
			Assert.CatchAsync<InvalidOperationException>(
				() => CreateProxy().ExecuteAsync(async s => await s.FunctionAsync() + 2)
			);
		}

		[Test]
		public void ExecuteAsync_FunctionAsync_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			var expectedResult = Task.FromResult(42);
			proxy.Client.ExecuteAsync<int>(Arg.Any<IActionMetadata>(), Arg.Any<object[]>()).Returns(expectedResult);

			var result = proxy.ExecuteAsync(s => s.FunctionAsync(15));

			proxy.Client.Received(1).ExecuteAsync<int>(
				GetActionMetadata(nameof(ITestService.FunctionAsync)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);

			Assert.AreEqual(expectedResult, result);
		}

		#endregion ExecuteAsync FunctionAsync

		#region GenerateUri Action

		[Test]
		public void GenerateUri_Action_NullService_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).GenerateUri(s => s.Action()));
		}

		[Test]
		public void GenerateUri_Action_NullAction_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => CreateProxy().GenerateUri((Action<ITestService>)null));
		}

		[Test]
		public void GenerateUri_Action_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(() => CreateProxy().GenerateUri(s => { }));
		}

		[Test]
		public void GenerateUri_Action_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().GenerateUri(
					s =>
					{
						s.Action();
						s.Action();
					}
				)
			);
		}

		[Test]
		public void GenerateUri_Action_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			var expectedResult = _uri;
			proxy.Client.GenerateUri(Arg.Any<IActionMetadata>(), Arg.Any<object[]>()).Returns(expectedResult);

			var result = proxy.GenerateUri(s => s.Action(15));

			proxy.Client.Received(1).GenerateUri(
				GetActionMetadata(nameof(ITestService.Action)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);

			Assert.AreSame(expectedResult, result);
		}

		#endregion GenerateUri Action

		#region GenerateUri ActionAsync

		[Test]
		public void GenerateUri_ActionAsync_NullService_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).GenerateUri(s => s.ActionAsync()));
		}

		[Test]
		public void GenerateUri_ActionAsync_NullAction_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => CreateProxy().GenerateUri((Func<ITestService, Task>)null));
		}

		[Test]
		public void GenerateUri_ActionAsync_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(() => CreateProxy().GenerateUri(s => Task.CompletedTask));
		}

		[Test]
		public void GenerateUri_ActionAsync_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().GenerateUri(
					s =>
					{
						s.Action();
						return s.ActionAsync();
					}
				)
			);
		}

		[Test]
		public void GenerateUri_ActionAsync_ResultChanged_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().GenerateUri(
					async s =>
					{
						await s.ActionAsync().ConfigureAwait(false);
					}
				)
			);
		}

		[Test]
		public void GenerateUri_ActionAsync_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			var expectedResult = _uri;
			proxy.Client.GenerateUri(Arg.Any<IActionMetadata>(), Arg.Any<object[]>()).Returns(expectedResult);

			var result = proxy.GenerateUri(s => s.ActionAsync(15));

			proxy.Client.Received(1).GenerateUri(
				GetActionMetadata(nameof(ITestService.ActionAsync)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);

			Assert.AreSame(expectedResult, result);
		}

		#endregion GenerateUri ActionAsync

		#region GenerateUri Function

		[Test]
		public void GenerateUri_Function_NullService_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).GenerateUri(s => s.Function()));
		}

		[Test]
		public void GenerateUri_Function_NullAction_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => CreateProxy().GenerateUri((Func<ITestService, int>)null));
		}

		[Test]
		public void GenerateUri_Function_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(() => CreateProxy().GenerateUri(s => 12));
		}

		[Test]
		public void GenerateUri_Function_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().GenerateUri(
					s =>
					{
						s.Action();
						return s.Function();
					}
				)
			);
		}

		[Test]
		public void GenerateUri_Function_ResultChanged_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().GenerateUri(s => s.Function() + 2)
			);
		}

		[Test]
		public void GenerateUri_Function_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			var expectedResult = _uri;
			proxy.Client.GenerateUri(Arg.Any<IActionMetadata>(), Arg.Any<object[]>()).Returns(expectedResult);

			var result = proxy.GenerateUri(s => s.Function(15));

			proxy.Client.Received(1).GenerateUri(
				GetActionMetadata(nameof(ITestService.Function)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);

			Assert.AreEqual(expectedResult, result);
		}

		#endregion GenerateUri Function

		#region GenerateUri FunctionAsync

		[Test]
		public void GenerateUri_FunctionAsync_NullService_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => ((IServiceProxy<ITestService>)null).GenerateUri(s => s.FunctionAsync()));
		}

		[Test]
		public void GenerateUri_FunctionAsync_NullAction_ThrowsArgumentNullException()
		{
			Assert.Catch<ArgumentNullException>(() => CreateProxy().GenerateUri((Func<ITestService, Task<int>>)null));
		}

		[Test]
		public void GenerateUri_FunctionAsync_NoActionCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(() => CreateProxy().GenerateUri(s => Task.FromResult(12)));
		}

		[Test]
		public void GenerateUri_FunctionAsync_TooManyActionsCalled_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().GenerateUri(
					s =>
					{
						s.Action();
						return s.FunctionAsync();
					}
				)
			);
		}

		[Test]
		public void GenerateUri_FunctionAsync_ResultChanged_ThrowsInvalidOperationException()
		{
			Assert.Catch<InvalidOperationException>(
				() => CreateProxy().GenerateUri(async s => await s.FunctionAsync() + 2)
			);
		}

		[Test]
		public void GenerateUri_FunctionAsync_CallsClientWithAppropriateActionMetadataAndArgs()
		{
			var proxy = CreateProxy();
			var expectedResult = _uri;
			proxy.Client.GenerateUri(Arg.Any<IActionMetadata>(), Arg.Any<object[]>()).Returns(_uri);

			var result = proxy.GenerateUri(s => s.FunctionAsync(15));

			proxy.Client.Received(1).GenerateUri(
				GetActionMetadata(nameof(ITestService.FunctionAsync)),
				Arg.Is<object[]>(args => args.SequenceEqual(15.Yield().Cast<object>()))
			);

			Assert.AreEqual(expectedResult, result);
		}

		#endregion GenerateUri FunctionAsync

		public interface ITestService
		{
			void Action(int value = 0);

			Task ActionAsync(int value = 0);

			int Function(int value = 0);

			Task<int> FunctionAsync(int value = 0);
		}
	}
}


text:
<?php
namespace Concrete\Core\Config\Repository;

/**
 * Class Liaison.
 *
 * \@package Concrete\Core\Config\Repository
 */
class Liaison
{
    /**
     * @var \Concrete\Core\Config\Repository\Repository
     */
    protected $repository;

    /**
     * @var string Default Namespace
     */
    protected $default_namespace;

    /**
     * Create a new configuration repository.
     *
     * @param \Concrete\Core\Config\Repository\Repository $repository
     * @param string                                      $default_namespace
     */
    public function __construct(\Concrete\Core\Config\Repository\Repository $repository, $default_namespace)
    {
        $this->default_namespace = $default_namespace;
        $this->repository = $repository;
    }

    /**
     * @param $key
     *
     * @return string
     */
    protected function transformKey($key)
    {
        list($namespace, $group, $item) = $this->repository->parseKey($key);
        if (!$namespace) {
            $namespace = $this->default_namespace;
        }

        $collection = "{$namespace}::{$group}";
        if ($item) {
            $collection .= ".{$item}";
        }

        return $collection;
    }

    /**
     * @param $key
     *
     * @return bool
     */
    public function has($key)
    {
        return $this->repository->has($this->transformKey($key));
    }

    /**
     * @param      $key
     * @param null $default
     *
     * @return mixed
     */
    public function get($key, $default = null)
    {
        return $this->repository->get($this->transformKey($key), $default);
    }

    /**
     * @param $key
     * @param $value
     *
     * @return bool
     */
    public function save($key, $value)
    {
        return $this->repository->save($this->transformKey($key), $value);
    }

    /**
     * @param $key
     * @param $value
     */
    public function set($key, $value)
    {
        $this->repository->set($this->transformKey($key), $value);
    }

    /**
     * @param $key
     */
    public function clear($key)
    {
        $this->repository->clear($this->transformKey($key));
    }

    /**
     * @return Repository
     */
    public function getRepository()
    {
        return $this->repository;
    }

    /**
     * @param Repository $repository
     */
    public function setRepository($repository)
    {
        $this->repository = $repository;
    }

    /**
     * @return string
     */
    public function getDefaultNamespace()
    {
        return $this->default_namespace;
    }

    /**
     * @param string $default_namespace
     */
    public function setDefaultNamespace($default_namespace)
    {
        $this->default_namespace = $default_namespace;
    }
}


text:
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# include/Makefile.  Generated from Makefile.in by configure.

# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

pkgdatadir = $(datadir)/yaml
pkgincludedir = $(includedir)/yaml
pkglibdir = $(libdir)/yaml
pkglibexecdir = $(libexecdir)/yaml
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-unknown-linux-gnu
host_triplet = x86_64-unknown-linux-gnu
subdir = include
DIST_COMMON = $(nobase_include_HEADERS) $(srcdir)/Makefile.am \
	$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
	$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
    *) f=$$p;; \
  esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
  for p in $$list; do echo "$$p $$p"; done | \
  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
    if (++n[$$2] == $(am__install_max)) \
      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
    END { for (dir in files) print dir, files[dir] }'
am__base_list = \
  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
  test -z "$$files" \
    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
         $(am__cd) "$$dir" && rm -f $$files; }; \
  }
am__installdirs = "$(DESTDIR)$(includedir)"
HEADERS = $(nobase_include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} /home/xue/works/project/rk3066/android-4.2.2_r1/external/yaml-0.1.5/config/missing --run aclocal-1.11
AMTAR = $${TAR-tar}
AR = ar
AUTOCONF = ${SHELL} /home/xue/works/project/rk3066/android-4.2.2_r1/external/yaml-0.1.5/config/missing --run autoconf
AUTOHEADER = ${SHELL} /home/xue/works/project/rk3066/android-4.2.2_r1/external/yaml-0.1.5/config/missing --run autoheader
AUTOMAKE = ${SHELL} /home/xue/works/project/rk3066/android-4.2.2_r1/external/yaml-0.1.5/config/missing --run automake-1.11
AWK = mawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = gcc -E
CPPFLAGS =
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DLLTOOL = false
DOXYGEN = false
DSYMUTIL =
DUMPBIN =
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
EXEEXT =
FGREP = /bin/grep -F
GREP = /bin/grep
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS =
LIBOBJS =
LIBS =
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /home/xue/works/project/rk3066/android-4.2.2_r1/external/yaml-0.1.5/config/missing --run makeinfo
MANIFEST_TOOL = :
MKDIR_P = /bin/mkdir -p
NM = /usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
OBJEXT = o
OTOOL =
OTOOL64 =
PACKAGE = yaml
PACKAGE_BUGREPORT = http://pyyaml.org/newticket?component=libyaml
PACKAGE_NAME = yaml
PACKAGE_STRING = yaml 0.1.5
PACKAGE_TARNAME = yaml
PACKAGE_URL =
PACKAGE_VERSION = 0.1.5
PATH_SEPARATOR = :
RANLIB = ranlib
SED = /bin/sed
SET_MAKE =
SHELL = /bin/sh
STRIP = strip
VERSION = 0.1.5
YAML_LT_AGE = 0
YAML_LT_CURRENT = 2
YAML_LT_RELEASE = 0
YAML_LT_REVISION = 3
abs_builddir = /home/xue/works/project/rk3066/android-4.2.2_r1/external/yaml-0.1.5/include
abs_srcdir = /home/xue/works/project/rk3066/android-4.2.2_r1/external/yaml-0.1.5/include
abs_top_builddir = /home/xue/works/project/rk3066/android-4.2.2_r1/external/yaml-0.1.5
abs_top_srcdir = /home/xue/works/project/rk3066/android-4.2.2_r1/external/yaml-0.1.5
ac_ct_AR = ar
ac_ct_CC = gcc
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__tar = $${TAR-tar} chof - "$$tardir"
am__untar = $${TAR-tar} xf -
bindir = ${exec_prefix}/bin
build = x86_64-unknown-linux-gnu
build_alias =
build_cpu = x86_64
build_os = linux-gnu
build_vendor = unknown
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = x86_64-unknown-linux-gnu
host_alias =
host_cpu = x86_64
host_os = linux-gnu
host_vendor = unknown
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /home/xue/works/project/rk3066/android-4.2.2_r1/external/yaml-0.1.5/config/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = /bin/mkdir -p
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target_alias =
top_build_prefix = ../
top_builddir = ..
top_srcdir = ..
INCLUDES = yaml.h
DOXYGEN_CFG = $(top_srcdir)/doc/doxygen.cfg
nobase_include_HEADERS = $(INCLUDES)
all: all-am

.SUFFIXES:
$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
	@for dep in $?; do \
	  case '$(am__configure_deps)' in \
	    *$$dep*) \
	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
	        && { if test -f $@; then exit 0; else break; fi; }; \
	      exit 1;; \
	  esac; \
	done; \
	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
	$(am__cd) $(top_srcdir) && \
	  $(AUTOMAKE) --foreign include/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	@case '$?' in \
	  *config.status*) \
	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
	  *) \
	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
	esac;

$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh

$(top_srcdir)/configure:  $(am__configure_deps)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):

mostlyclean-libtool:
	-rm -f *.lo

clean-libtool:
	-rm -rf .libs _libs
install-nobase_includeHEADERS: $(nobase_include_HEADERS)
	@$(NORMAL_INSTALL)
	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
	@list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
	$(am__nobase_list) | while read dir files; do \
	  xfiles=; for file in $$files; do \
	    if test -f "$$file"; then xfiles="$$xfiles $$file"; \
	    else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
	  test -z "$$xfiles" || { \
	    test "x$$dir" = x. || { \
	      echo "$(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \
	      $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \
	    echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \
	    $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit $$?; }; \
	done

uninstall-nobase_includeHEADERS:
	@$(NORMAL_UNINSTALL)
	@list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
	$(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)

ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
	mkid -fID $$unique
tags: TAGS

TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	set x; \
	here=`pwd`; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
	shift; \
	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
	  test -n "$$unique" || unique=$$empty_fix; \
	  if test $$# -gt 0; then \
	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	      "$$@" $$unique; \
	  else \
	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	      $$unique; \
	  fi; \
	fi
ctags: CTAGS
CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
	test -z "$(CTAGS_ARGS)$$unique" \
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
	     $$unique

GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && $(am__cd) $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) "$$here"

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
	  dist_files=`for file in $$list; do echo $$file; done | \
	  sed -e "s|^$$srcdirstrip/||;t" \
	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
	case $$dist_files in \
	  */*) $(MKDIR_P) `echo "$$dist_files" | \
			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
			   sort -u` ;; \
	esac; \
	for file in $$dist_files; do \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  if test -d $$d/$$file; then \
	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
	    if test -d "$(distdir)/$$file"; then \
	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
	    fi; \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
	    fi; \
	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
	  else \
	    test -f "$(distdir)/$$file" \
	    || cp -p $$d/$$file "$(distdir)/$$file" \
	    || exit 1; \
	  fi; \
	done
	$(MAKE) $(AM_MAKEFLAGS) \
	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
	  dist-hook
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
	for dir in "$(DESTDIR)$(includedir)"; do \
	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
	done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-am
install-strip:
	if test -z '$(STRIP)'; then \
	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	      install; \
	else \
	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
	fi
mostlyclean-generic:

clean-generic:

distclean-generic:
	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)

maintainer-clean-generic:
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
clean: clean-am

clean-am: clean-generic clean-libtool mostlyclean-am

distclean: distclean-am
	-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags

dvi: dvi-am

dvi-am:

html: html-am

html-am:

info: info-am

info-am:

install-data-am: install-nobase_includeHEADERS

install-dvi: install-dvi-am

install-dvi-am:

install-exec-am:

install-html: install-html-am

install-html-am:

install-info: install-info-am

install-info-am:

install-man:

install-pdf: install-pdf-am

install-pdf-am:

install-ps: install-ps-am

install-ps-am:

installcheck-am:

maintainer-clean: maintainer-clean-am
	-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic \
	maintainer-clean-local

mostlyclean: mostlyclean-am

mostlyclean-am: mostlyclean-generic mostlyclean-libtool

pdf: pdf-am

pdf-am:

ps: ps-am

ps-am:

uninstall-am: uninstall-nobase_includeHEADERS

.MAKE: install-am install-strip

.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
	clean-libtool ctags dist-hook distclean distclean-generic \
	distclean-libtool distclean-tags distdir dvi dvi-am html \
	html-am info info-am install install-am install-data \
	install-data-am install-dvi install-dvi-am install-exec \
	install-exec-am install-html install-html-am install-info \
	install-info-am install-man install-nobase_includeHEADERS \
	install-pdf install-pdf-am install-ps install-ps-am \
	install-strip installcheck installcheck-am installdirs \
	maintainer-clean maintainer-clean-generic \
	maintainer-clean-local mostlyclean mostlyclean-generic \
	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
	uninstall-am uninstall-nobase_includeHEADERS

#html: $(INCLUDES) $(DOXYGEN_CFG)
#	PACKAGE=$(PACKAGE) VERSION=$(VERSION) top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) doxygen $(DOXYGEN_CFG)

maintainer-clean-local:
	-rm -rf $(top_builddir)/doc/html

dist-hook: html
	cp -a $(top_builddir)/doc/html $(top_distdir)/doc

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:


text:
using System;
using System.Threading.Tasks;
using ImplicitNullability.Samples.CodeWithoutIN;
using JetBrains.Annotations;
using static ImplicitNullability.Samples.CodeWithIN.ReSharper;

namespace ImplicitNullability.Samples.CodeWithIN.NullabilityAnalysis
{
    public static class DelegatesSample
    {
        public static Action<string> GetSomeAction()
        {
            return s => TestValueAnalysis(s, s == null);
        }

        public static Action<string> GetSomeActionWithClosedValues()
        {
            var captured = Guid.NewGuid();
            return s =>
            {
                TestValueAnalysis(s, s == null);
                SuppressUnusedWarning(captured);
            };
        }

        public static Action<string> GetSomeActionToAnonymousMethod()
        {
            return delegate(string s) { TestValueAnalysis(s, s == null); };
        }

        //

        public delegate void SomeDelegate(string s);

        public static SomeDelegate GetSomeDelegate()
        {
            return s => TestValueAnalysis(s, s == null /* REPORTED false negative https://youtrack.jetbrains.com/issue/RSRP-446852 */);
        }

        public static SomeDelegate GetSomeDelegateToNamedMethod()
        {
            return NamedMethod;
        }

        public static SomeDelegate GetSomeDelegateToNamedMethodWithCanBeNull()
        {
            return NamedMethodWithCanBeNull;
        }

        public delegate void SomeDelegateWithCanBeNull([CanBeNull] string s);

        public static SomeDelegateWithCanBeNull GetSomeDelegateWithCanBeNull()
        {
            return s => TestValueAnalysis(s /* REPORTED false negative https://youtrack.jetbrains.com/issue/RSRP-446852 */, s == null);
        }

        public static SomeDelegateWithCanBeNull GetSomeDelegateWithCanBeNullToNamedMethod()
        {
            // REPORT? Here R# could warn about the precondition substitutability issue
            return NamedMethod;
        }

        public static SomeDelegateWithCanBeNull GetSomeDelegateWithCanBeNullToNamedMethodWithCanBeNull()
        {
            return NamedMethodWithCanBeNull;
        }

        //

        [NotNull]
        public delegate string SomeFunctionDelegateWithNotNull();

        public static SomeFunctionDelegateWithNotNull GetSomeFunctionDelegateWithNotNull()
        {
            return () => null /*Expect:AssignNullToNotNullAttribute*/;
        }

        public delegate string SomeFunctionDelegate();

        public static SomeFunctionDelegate GetSomeFunctionDelegate()
        {
            return () => null /*Expect:AssignNullToNotNullAttribute[MOut]*/;
        }

        public static SomeFunctionDelegate GetSomeFunctionDelegateToNamedMethod()
        {
            // REPORT? Here R# could warn about the postcondition substitutability issue
            return NamedFunctionWithCanBeNull;
        }

        [CanBeNull]
        public delegate string SomeFunctionDelegateWithCanBeNull();

        public static SomeFunctionDelegateWithCanBeNull GetSomeFunctionDelegateWithCanBeNull()
        {
            return () => null;
        }

        //

        public static External.SomeNotNullDelegate GetSomeNotNullDelegateOfExternalCode()
        {
            return s => TestValueAnalysis(s, s == null /* REPORTED false negative https://youtrack.jetbrains.com/issue/RSRP-446852 */);
        }

        public static External.SomeDelegate GetSomeDelegateOfExternalCode()
        {
            return s => TestValueAnalysis(s, s == null);
        }

        //

        [ItemNotNull]
        public delegate Task<string> SomeAsyncFunctionDelegateWithNotNull();

        public static SomeAsyncFunctionDelegateWithNotNull GetSomeAsyncFunctionDelegateWithNotNull()
        {
            return async () => await Async.CanBeNullResult<string>() /*Expect:AssignNullToNotNullAttribute*/;
        }

        public delegate Task<string> SomeAsyncFunctionDelegate();

        public static SomeAsyncFunctionDelegate GetSomeAsyncFunctionDelegate()
        {
            return async () => await Async.CanBeNullResult<string>() /*Expect:AssignNullToNotNullAttribute[MOut]*/;
        }

        [ItemCanBeNull]
        public delegate Task<string> SomeAsyncFunctionDelegateWithCanBeNull();

        public static SomeAsyncFunctionDelegateWithCanBeNull GetSomeAsyncFunctionDelegateWithCanBeNull()
        {
            return async () => await Async.CanBeNullResult<string>();
        }

        //

        public delegate void SomeDelegateWithRefAndOut(ref string refParam, out string outParam);

        public static SomeDelegateWithRefAndOut GetSomeDelegateWithRefAndOut()
        {
            return delegate(ref string refParam, out string outParam)
            {
                TestValueAnalysis(refParam, refParam == null);

                // For ref and out-parameters (in contrast to the return value), R# doesn't seem to use the delegate annotations:
                refParam = null;
                outParam = null;
            };
        }

        //

        private static void NamedMethod(string a)
        {
        }

        private static void NamedMethodWithCanBeNull([CanBeNull] string a)
        {
        }

        [CanBeNull]
        private static string NamedFunctionWithCanBeNull()
        {
            return null;
        }

        //

        public static void ActionDelegateConstructor()
        {
            Action nullAction = null;

            // Here the target parameter is a Special.Parameter, which is an IParameter. Note that this is an "builtin" null ref warning. Nullability
            // annotations are not involved for this error, although the annotation provider is being called (observed in R# 8.2).
            var action = new Action(nullAction /*Expect:PossibleNullReferenceException*/);
            SuppressUnusedWarning(action);
        }
    }
}


text:
<!DOCTYPE html>

  {% include head.html %}

      {% include header.html %}

        {% include about.html %}

        {% include projects.html %}

      {{ content }}

      {% include footer.html %}


text:
struct times2 {typedef int result_type; times2(int) {}; int operator()(int x) const {return 2 * x;}};

template <typename T>
struct add1 {typedef T result_type; T operator()(const T& x) const {return x + 1;}};

template <typename T>
struct add1_val {typedef T result_type; T operator()(T x) const {return x + 1;}};

template <typename T>
struct return_fixed_ref {
  int* ptr;
  return_fixed_ref(int* ptr): ptr(ptr) {}
  typedef int& result_type;
  int& operator()(const T&) const {return *ptr;}
};

int test_main(int, char**) {
  using namespace boost;
  typedef function_property_map<times2, int> PM;
  PM orig_pm(times2(0));
  BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<transform_value_property_map<add1<int>, PM>, int>));
  BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<transform_value_property_map<add1<int>, PM, double>, int>));
  BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<transform_value_property_map<add1_val<int>, PM>, int>));
  BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<transform_value_property_map<add1_val<int>, PM, double>, int>));
  BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<transform_value_property_map<return_fixed_ref<int>, PM>, int>));
  BOOST_CONCEPT_ASSERT((WritablePropertyMapConcept<transform_value_property_map<return_fixed_ref<int>, PM>, int>));
  BOOST_CONCEPT_ASSERT((ReadWritePropertyMapConcept<transform_value_property_map<return_fixed_ref<int>, PM>, int>));
  BOOST_CONCEPT_ASSERT((LvaluePropertyMapConcept<transform_value_property_map<return_fixed_ref<int>, PM>, int>));

  BOOST_STATIC_ASSERT((boost::is_same<boost::property_traits<transform_value_property_map<add1<int>, PM> >::category, boost::readable_property_map_tag>::value));
  BOOST_STATIC_ASSERT((boost::is_same<boost::property_traits<transform_value_property_map<add1_val<int>, PM> >::category, boost::readable_property_map_tag>::value));
  BOOST_STATIC_ASSERT((boost::is_same<boost::property_traits<transform_value_property_map<return_fixed_ref<int>, PM> >::category, boost::lvalue_property_map_tag>::value));

  BOOST_CHECK(get(transform_value_property_map<add1<int>, PM>(add1<int>(), orig_pm), 3) == 7);
  BOOST_CHECK(get(transform_value_property_map<add1<int>, PM>(add1<int>(), orig_pm), 4) == 9);
  BOOST_CHECK(get(make_transform_value_property_map(add1<int>(), orig_pm), 5) == 11);
  BOOST_CHECK(get(transform_value_property_map<add1_val<int>, PM>(add1_val<int>(), orig_pm), 3) == 7);
  BOOST_CHECK(get(transform_value_property_map<add1_val<int>, PM>(add1_val<int>(), orig_pm), 4) == 9);
  BOOST_CHECK(get(make_transform_value_property_map<int>(add1_val<int>(), orig_pm), 5) == 11);
  int val;
  const transform_value_property_map<return_fixed_ref<int>, PM> pm(return_fixed_ref<int>((&val)), orig_pm);
  put(pm, 1, 6);
  BOOST_CHECK(get(pm, 2) == 6);
  BOOST_CHECK((get(pm, 3) = 7) == 7);
  BOOST_CHECK(get(pm, 4) == 7);
  const transform_value_property_map<return_fixed_ref<int>, PM> pm2 = pm; // Check shallow copying
  BOOST_CHECK(get(pm2, 5) == 7);
  put(pm2, 3, 1);
  BOOST_CHECK(get(pm, 1) == 1);

  return 0;
}


text:
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Rule = (function (_super) {
    __extends(Rule, _super);
    function Rule() {
        _super.apply(this, arguments);
    }
    Rule.prototype.apply = function (sourceFile) {
        return this.applyWithWalker(new NameWalker(sourceFile, this.getOptions()));
    };
    Rule.FAILURE_STRING = "interface name must be a capitalized I";
    return Rule;
})(Lint.Rules.AbstractRule);
exports.Rule = Rule;
var NameWalker = (function (_super) {
    __extends(NameWalker, _super);
    function NameWalker() {
        _super.apply(this, arguments);
    }
    NameWalker.prototype.visitInterfaceDeclaration = function (node) {
        var interfaceName = node.name.text;
        if (!this.startsWithI(interfaceName)) {
            this.addFailureAt(node.name.getStart(), node.name.getWidth());
        }
        _super.prototype.visitInterfaceDeclaration.call(this, node);
    };
    NameWalker.prototype.startsWithI = function (name) {
        if (name.length <= 0) {
            return true;
        }
        var firstCharacter = name.charAt(0);
        return (firstCharacter === "I");
    };
    NameWalker.prototype.addFailureAt = function (position, width) {
        var failure = this.createFailure(position, width, Rule.FAILURE_STRING);
        this.addFailure(failure);
    };
    return NameWalker;
})(Lint.RuleWalker);


text:
package com.piggymetrics.notification.controller;

import com.piggymetrics.notification.domain.Recipient;
import com.piggymetrics.notification.service.RecipientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.security.Principal;

@RestController
@RequestMapping("/recipients")
public class RecipientController {

	@Autowired
	private RecipientService recipientService;

	@RequestMapping(path = "/current", method = RequestMethod.GET)
	public Object getCurrentNotificationsSettings(Principal principal) {
		return recipientService.findByAccountName(principal.getName());
	}

	@RequestMapping(path = "/current", method = RequestMethod.PUT)
	public Object saveCurrentNotificationsSettings(Principal principal, @Valid @RequestBody Recipient recipient) {
		return recipientService.save(principal.getName(), recipient);
	}
}


text:
package stoop

import spray.json._

sealed trait CouchView {
  def name: String
  def map: String
}
case class CouchMap(name: String, map: String) extends CouchView
case class CouchMapReduce(name: String, map: String, reduce: String) extends CouchView

object CouchView {
  implicit val couchViewWriter: JsonWriter[CouchView] = new JsonWriter[CouchView] {
    import DefaultJsonProtocol._
    def write(view: CouchView) = view match {
      case CouchMap(db, fn) =>
        JsObject(Map("map" -> JsString(fn)))
      case CouchMapReduce(db, map, reduce) =>
        JsObject(Map("map" -> JsString(map), "reduce" -> JsString(reduce)))
    }
  }
}