text:
namespace mongocxx {
MONGOCXX_INLINE_NAMESPACE_BEGIN

///
/// Class supporting operations for MongoDB Client-Side Field Level Encryption.
///
class MONGOCXX_API client_encryption {
   public:
    ///
    /// Creates a client_encryption object.
    ///
    /// @param opts
    ///   An object representing encryption options.
    ///
    /// @see https://docs.mongodb.com/ecosystem/use-cases/client-side-field-level-encryption-guide
    ///
    client_encryption(options::client_encryption opts);

    ///
    /// Destroys a client_encryption.
    ///
    ~client_encryption() noexcept;

    ///
    /// Move-constructs a client_encryption object.
    ///
    client_encryption(client_encryption&&);

    ///
    /// Move-assigns a client_encryption object.
    ///
    client_encryption& operator=(client_encryption&&);

    client_encryption(const client_encryption&) = delete;
    client_encryption& operator=(const client_encryption&) = delete;

    ///
    /// Creates a new key document and inserts into the key vault collection.
    ///
    /// @param kms_provider
    ///   A string identifying the KMS service to use to encrypt the datakey.
    ///   Must be one of "aws", "azure", "gcp", "kmip", or "local".
    /// @param opts
    ///   Optional arguments, see options::data_key.
    ///
    /// @return The id of the created document as a bson_value::value containing
    ///   a UUID (BSON binary subtype 4).
    ///
    /// @throws mongocxx::exception if there is an error creating the key.
    ///
    /// @see
    /// https://docs.mongodb.com/ecosystem/use-cases/client-side-field-level-encryption-guide/#b-create-a-data-encryption-key
    ///
    bsoncxx::types::bson_value::value create_data_key(std::string kms_provider,
                                                      const options::data_key& opts = {});

    ///
    /// Encrypts a BSON value with a given key and algorithm.
    ///
    /// @param value
    ///   The BSON value to encrypt.
    /// @param opts
    ///   Options must be given in order to specify an encryption algorithm
    ///   and a key_id or key_alt_name. See options::encrypt.
    ///
    /// @return The encrypted value (BSON binary subtype 6).
    ///
    /// @throws mongocxx::exception if there is an error encrypting the value.
    ///
    /// @see
    /// https://docs.mongodb.com/manual/reference/method/ClientEncryption.encrypt/#ClientEncryption.encrypt
    ///
    bsoncxx::types::bson_value::value encrypt(bsoncxx::types::bson_value::view value,
                                              const options::encrypt& opts);

    ///
    /// Decrypts an encrypted value (BSON binary of subtype 6).
    ///
    /// @param value
    ///   The encrypted value.
    ///
    /// @return The original BSON value.
    ///
    /// @throws mongocxx::exception if there is an error decrypting the value.
    ///
    /// @see
    /// https://docs.mongodb.com/manual/reference/method/ClientEncryption.decrypt/#ClientEncryption.decrypt
    ///
    bsoncxx::types::bson_value::value decrypt(bsoncxx::types::bson_value::view value);

   private:
    class MONGOCXX_PRIVATE impl;

    std::unique_ptr<impl> _impl;
};

MONGOCXX_INLINE_NAMESPACE_END
}  // namespace mongocxx

#include <mongocxx/config/postlude.hpp>


text:
package org.bboxdb.network.server.connection.handler.request;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.bboxdb.misc.BBoxDBException;
import org.bboxdb.network.routing.PackageRouter;
import org.bboxdb.network.routing.RoutingHeader;
import org.bboxdb.network.routing.RoutingHop;
import org.bboxdb.network.packets.PacketEncodeException;
import org.bboxdb.network.packets.request.LockTupleRequest;
import org.bboxdb.network.packets.response.ErrorResponse;
import org.bboxdb.network.packets.response.SuccessResponse;
import org.bboxdb.network.routing.DistributionRegionHandlingFlag;
import org.bboxdb.network.server.connection.ClientConnectionHandler;
import org.bboxdb.network.server.connection.lock.LockManager;
import org.bboxdb.network.server.query.ErrorMessages;
import org.bboxdb.storage.StorageManagerException;
import org.bboxdb.storage.entity.Tuple;
import org.bboxdb.storage.entity.TupleStoreName;
import org.bboxdb.storage.tuplestore.manager.TupleStoreManager;
import org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LockTupleHandler implements RequestHandler {

	/**
	 * There is no old version known
	 */
	public final static int NO_VERSION_KNOWN = -1;

	/**
	 * The Logger
	 */
	private final static Logger logger = LoggerFactory.getLogger(LockTupleHandler.class);

	@Override
	/**
	 * Lock the given tuple
	 */
	public boolean handleRequest(final ByteBuffer encodedPackage,
			final short packageSequence, final ClientConnectionHandler clientConnectionHandler) throws IOException, PacketEncodeException {

		try {
			final LockTupleRequest request = LockTupleRequest.decodeTuple(encodedPackage);
			final short sequenceNumber = request.getSequenceNumber();
			final String table = request.getTablename();
			final String key = request.getKey();
			final long version = request.getVersion();
			final boolean deleteOnTimeout = request.isDeleteOnTimeout();

			if(logger.isDebugEnabled()) {
				logger.debug("Locking tuple {} in table {} with version {}", key, table, version);
			}

			final long localVersion = getLocalTupleVersion(clientConnectionHandler, request);

			if(localVersion != version) {
				logger.info("Locking {} in table {} outdated. Local {} requested {}", key, table, localVersion, version);
				final ErrorResponse responsePackage = new ErrorResponse(packageSequence, ErrorMessages.ERROR_LOCK_FAILED_OUTDATED);
				clientConnectionHandler.writeResultPackage(responsePackage);
				return true;
			}

			final LockManager lockManager = clientConnectionHandler.getLockManager();
			final boolean lockResult = lockManager.lockTuple(clientConnectionHandler, sequenceNumber,
					table, key, version, deleteOnTimeout);

			if(lockResult == false) {
				logger.info("Lock tuple failed, pair {} / {} already locked", key, table);
				final ErrorResponse responsePackage = new ErrorResponse(packageSequence, ErrorMessages.ERROR_LOCK_FAILED_ALREADY_LOCKED);
				clientConnectionHandler.writeResultPackage(responsePackage);
				return true;
			}

			// Lock was successfully
			logger.debug("Lock for {} / {} was successfully", key, table);
			clientConnectionHandler.writeResultPackage(new SuccessResponse(packageSequence));
			clientConnectionHandler.flushPendingCompressionPackages();
		} catch (Exception e) {
			logger.warn("Error while locking tuple", e);
			final ErrorResponse responsePackage = new ErrorResponse(packageSequence, ErrorMessages.ERROR_EXCEPTION);
			clientConnectionHandler.writeResultPackage(responsePackage);
			clientConnectionHandler.flushPendingCompressionPackages();
		}

		return true;
	}

	/**
	 * Get the local tuple version
	 *
	 * @param clientConnectionHandler
	 * @param request
	 * @return
	 * @throws BBoxDBException
	 * @throws PacketEncodeException
	 * @throws StorageManagerException
	 */
	private long getLocalTupleVersion(final ClientConnectionHandler clientConnectionHandler,
			final LockTupleRequest request) throws BBoxDBException, PacketEncodeException, StorageManagerException {

		final List<Tuple> tuplesForKey = getAllTuplesForKey(clientConnectionHandler, request);

		return tuplesForKey
				.stream()
				.mapToLong(t -> t.getVersionTimestamp())
				.max()
				.orElse(NO_VERSION_KNOWN);
	}

	/**
	 * Get all tuples for the given key
	 *
	 * @param clientConnectionHandler
	 * @param request
	 * @param table
	 * @param key
	 * @return
	 * @throws BBoxDBException
	 * @throws PacketEncodeException
	 * @throws StorageManagerException
	 */
	private List<Tuple> getAllTuplesForKey(final ClientConnectionHandler clientConnectionHandler,
			final LockTupleRequest request) throws BBoxDBException, PacketEncodeException,
			StorageManagerException {

		final String table = request.getTablename();
		final String key = request.getKey();

		final TupleStoreName requestTable = new TupleStoreName(table);

		final RoutingHeader routingHeader = request.getRoutingHeader();
		final RoutingHop localHop = routingHeader.getRoutingHop();

		PackageRouter.checkLocalSystemNameMatchesAndThrowException(localHop);

		final Map<Long, EnumSet<DistributionRegionHandlingFlag>> distributionRegions = localHop.getDistributionRegions();
		final List<Tuple> tuplesForKey = new ArrayList<>();

		final Map<TupleStoreName, EnumSet<DistributionRegionHandlingFlag>> localTables = new HashMap<>();
		for(final Entry<Long, EnumSet<DistributionRegionHandlingFlag>> entry : distributionRegions.entrySet()) {
			localTables.put(requestTable.cloneWithDifferntRegionId(entry.getKey()), entry.getValue());
		}

		for(final TupleStoreName tupleStoreName : localTables.keySet()) {

			final TupleStoreManagerRegistry storageRegistry = clientConnectionHandler
					.getStorageRegistry();

			// Ignore non existing tables
			if(! storageRegistry.isStorageManagerKnown(tupleStoreName)) {
				continue;
			}

			final TupleStoreManager storageManager = storageRegistry
					.getTupleStoreManager(tupleStoreName);

			final List<Tuple> tuplesInTable = storageManager.get(key);
			tuplesForKey.addAll(tuplesInTable);
		}

		return tuplesForKey;
	}

}

redpajama_set_name: RedPajamaGithub


text:
(function() {
    'use strict';

    angular
        .module('shipyard')
        .config(getRoutes);

    getRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];

    function getRoutes($stateProvider, $urlRouterProvider) {
        $stateProvider
            .state('error', {
                templateUrl: 'app/error/error.html',
                authenticate: false
            });
        $urlRouterProvider.otherwise(function ($injector) {
            var $state = $injector.get('$state');
            $state.go('dashboard.containers');
        });
    }
})();


text:
package apoc.index;

import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.search.NumericRangeQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermRangeQuery;
import org.apache.lucene.util.BytesRef;
import org.hamcrest.CoreMatchers;
import org.junit.Test;

import static apoc.index.FreeTextQueryParser.parseFreeTextQuery;
import static org.apache.lucene.search.NumericRangeQuery.newDoubleRange;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

public class FreeTextQueryParserTest {
    @Test
    public void shouldParseNumericRange() throws Exception {
        assertNumRange("num:[10 TO 15]", 10.0, 15.0);
        assertNumRange("num:[10 TO *]", 10.0, null);
        assertNumRange("num:[* TO 20]", null, 20.0);
        assertTextRange("num:[* TO *]", null, null);
        assertTextRange("[10 TO 15]", "10", "15");
        assertTextRange("num:[1 TO two]", "1", "two");
        assertTextRange("num:[one TO 2]", "one", "2");
    }

    private static void assertNumRange(String query, Double lo, Double hi) throws ParseException {
        Query parsed = parseFreeTextQuery(query);
        assertThat(parsed, CoreMatchers.instanceOf(NumericRangeQuery.class));
        assertEquals(newDoubleRange(((NumericRangeQuery) parsed).getField(), lo, hi, true, true), parsed);
    }

    private static void assertTextRange(String query, String lo, String hi) throws ParseException {
        Query parsed = parseFreeTextQuery(query);
        assertThat(parsed, CoreMatchers.instanceOf(TermRangeQuery.class));
        assertEquals(new TermRangeQuery(((TermRangeQuery) parsed).getField(),
                lo == null ? null : new BytesRef(lo),
                hi == null ? null : new BytesRef(hi), true, true), parsed);
    }
}


text:
angular
  .module('app')
  .controller('NewExpenseController', NewExpenseController)

  function NewExpenseController(ExpenseService, CategoryService, $location){
    var ctrl = this;

    CategoryService.getCategories().then(function(res){
      ctrl.categories = res.data;
    });

   // ctrl.expense = new Expense();

    ctrl.addExpense = function(){
        var params={
          name: ctrl.name,
          category_id: ctrl.category_id,
          amount: ctrl.amount,
          description: ctrl.description
        }

        ExpenseService.createExpense(params).then(function(response){
          $location.path('expenses');
        });
    }

    //ctrl.addExpense = function(){
    // ctrl.expense.$save(function(){
     //   $location.path('expenses');
    // });
    //};
  }


text:
using System;
using CookComputing.XmlRpc;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace POSSIBLE.WordPress.XmlRpcClient.Models
{
    /// <summary>
    /// Represents a WordPress user's blogs
    /// </summary>
    [XmlRpcMissingMapping(MappingAction.Ignore)]
    public struct UserBlog
    {
        public string blogid { get; set; }
        public string blogName { get; set; }
        public string url { get; set; }
        public string xmlrpc { get; set; }
        public bool isAdmin { get; set; }
    }
}


text:
package com.xinfan.blueblue.activity.systemset;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import com.xinfan.blueblue.activity.R;

public class AboutUs extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.about_us);

	}

	public void AboutEsc(View v) {
		this.finish();
	}

	public boolean onTouchEvent(MotionEvent event) {
		finish();
		return true;
	}

}


text:
#import <React/RCTPackagerClient.h>

@class RCTBridge;

#if RCT_DEV // Only supported in dev mode

@interface RCTReloadPackagerMethod : NSObject <RCTPackagerClientMethod>

- (instancetype)initWithBridge:(RCTBridge *)bridge;

@end

#endif


text:
<?php

namespace Graze\CiffRenderer\Test\Parser\FieldParser;

use Mockery as m;
use Graze\CiffRenderer\Test\AbstractFieldParserTest;
use Graze\CiffRenderer\Parser\FieldParser\FieldParserFixedText;
use \SimpleXMLElement;

class FieldParserFixedTextTest extends AbstractFieldParserTest
{
    /**
     * @return SimpleXMLElement
     */
    private function getXmlField()
    {
        return new SimpleXMLElement(
            '<Field Name="i am field name">
                <FldType>MergeField</FldType>
                <X>4200</X>
                <Y>250</Y>
                <W>3775</W>
                <H>450</H>
                <Ln>1</Ln>
                <CalcData><![CDATA[8788888]]></CalcData>
                <Data>
                    <Object>
                        <DataType>5</DataType>
                        <Default><![CDATA[212]]></Default>
                        <SrcField SrcFieldName="i am source name 1"/>
                    </Object>
                    <Object Index="1">
                        <DataType>5</DataType>
                        <Default><![CDATA[1310]]></Default>
                        <SrcField SrcFieldName="i am source name 2"/>
                    </Object>
                </Data>
                <Text>
                    <Font>
                        <Face><![CDATA[i am font face]]></Face>
                        <Pitch>5</Pitch>
                    </Font>
                    <Block Compatibility="0">
                        <BlkJustify>Center</BlkJustify>
                    </Block>
                </Text>
                <Orientation>90</Orientation>
            </Field>'
        );
    }

    /**
     * @return FieldParserFixedText
     */
    protected function getParser()
    {
        if (!$this->parser) {
            $this->parser = new FieldParserFixedText(
                $this->fieldParserRegistry,
                $this->xmlHeader,
                $this->getXmlField(),
                $this->scale
            );
        }

        return $this->parser;
    }

    public function testGetFontSize()
    {
        $expected = 263;
        $this->assertEquals($expected, $this->getParser()->getFontSize());
    }

    public function testGetFontFace()
    {
        $face = 'i am font face';
        $this->assertEquals($face, $this->getParser()->getFontFace());
    }

    public function testGetOrientation()
    {
        $orientation = 90;
        $this->assertEquals($orientation, $this->getParser()->getOrientation());
    }

    public function testGetText()
    {
        $fieldMergeSource1 = m::mock(FieldParserFixedText::class)
            ->shouldReceive('getText')
            ->andReturn('i am text 1 ')
            ->once()
            ->getMock();
        $fieldMergeSource2 = m::mock(FieldParserFixedText::class)
            ->shouldReceive('getText')
            ->andReturn('and i am text 2')
            ->once()
            ->getMock();

        $this->fieldParserRegistry
            ->shouldReceive('getParser')
            ->with('i am source name 1')
            ->andReturn($fieldMergeSource1)
            ->once()
            ->shouldReceive('getParser')
            ->with('i am source name 2')
            ->andReturn($fieldMergeSource2)
            ->once()
            ->getMock();

        $expected = 'i am text 1 and i am text 2';
        $this->assertEquals($expected, $this->getParser()->getText());
    }

    public function testGetTextAlignment()
    {
        $this->assertEquals(FieldParserFixedText::ALIGN_CENTRE, $this->getParser()->getTextAlignment());
    }
}


text:
<?php

class SitemapController extends yupe\components\controllers\FrontController
{
    public $cacheKey = "sitemap::sitemap.xml";
    public $cacheKeyLock = "sitemap::lock";
    public $cacheKeyPart = "sitemap::part::";
    public $cacheKeyNumberParts = "sitemap::number::parts";

    private $maxLinksCount = 25000;

    public function actionIndex()
    {
        if (!($numberParts = Yii::app()->getCache()->get($this->cacheKeyNumberParts))) {
            if (!Yii::app()->getCache()->get($this->cacheKeyLock)) {
                Yii::app()->getCache()->set($this->cacheKeyLock, true, 90);

                set_time_limit(120);

                $urls = [];
                $cacheTime = $this->getModule()->cacheTime * 3600 + 1;

                $modules = require_once(Yii::getPathOfAlias('sitemap.config') . DIRECTORY_SEPARATOR . 'modules.php');

                foreach ($modules as $name => $moduleModels) {
                    $module = Yii::app()->getModule($name);
                    if (null != $module && $module->getIsInstalled()) {
                        foreach ($moduleModels as $options) {
                            $dataProvider = $options['getDataProvider']();
                            $iterator = new CDataProviderIterator($dataProvider, 100);
                            foreach ($iterator as $model) {
                                $urls[] = $this->getUrlRow(
                                    $options['getUrl']($model),
                                    $options['changeFreq'],
                                    $options['priority'],
                                    $options['getLastMod']($model)
                                );
                            }
                        }
                    }
                }

                $host = Yii::app()->getRequest()->hostInfo;
                $pagesDataProvider = new CActiveDataProvider(SitemapPage::model()->active(), []);
                $pagesIterator = new CDataProviderIterator($pagesDataProvider, 100);
                foreach ($pagesIterator as $page) {
                    $urls[] = $this->getUrlRow(
                        $host . '/' . ltrim(str_replace($host, '', $page->url), '/'),
                        $page->changefreq,
                        $page->priority
                    );
                }

                $parts = array_chunk($urls, $this->maxLinksCount);
                foreach ($parts as $key => $part) {
                    $xml = join("", $part);
                    Yii::app()->getCache()->set($this->cacheKeyPart . $key, $xml, $cacheTime);
                }

                $numberParts = count($parts);
                Yii::app()->getCache()->set($this->cacheKeyNumberParts, $numberParts, $cacheTime);

                Yii::app()->getCache()->delete($this->cacheKeyLock);
            }
        }

        header("Content-type: text/xml");
        echo $this->getXmlHead();

        if ($numberParts == 1) {
            echo $this->getUrlSetFromCache(0);
        } else {
            echo $this->getSitemapIndex($numberParts);
        }
        Yii::app()->end();
    }

    public function actionPart($number)
    {
        header("Content-type: text/xml");
        echo $this->getXmlHead();
        echo $this->getUrlSetFromCache($number);
    }

    private function getXmlHead()
    {
        return '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
    }

    private function getUrlSetFromCache($partNumber)
    {
        $res = CHtml::openTag('urlset', ['xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9']);
        $res .= Yii::app()->getCache()->get($this->cacheKeyPart . $partNumber);;
        $res .= CHtml::closeTag('urlset');

        return $res;
    }

    private function getSitemapIndex($numberParts = null)
    {
        $numberParts = $numberParts ? : Yii::app()->getCache()->get($this->cacheKeyNumberParts);
        $res = CHtml::openTag('sitemapindex', ['xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9']);
        for ($i = 0; $i < (int)$numberParts; $i++) {
            $res .= CHtml::openTag('sitemap');
            $res .= CHtml::tag(
                'loc',
                [],
                htmlspecialchars(Yii::app()->createAbsoluteUrl('sitemap/sitemap/part', ['number' => $i]))
            );
            $res .= CHtml::closeTag('sitemap');
        }
        $res .= CHtml::closeTag('sitemapindex');

        return $res;
    }

    private function getUrlRow($loc, $changefreq = SitemapHelper::FREQUENCY_DAILY, $priority = 0.5, $lastmod = null)
    {
        $res = CHtml::openTag('url');
        $res .= CHtml::tag('loc', [], htmlspecialchars($loc));
        $res .= CHtml::tag('changefreq', [], $changefreq);
        $res .= CHtml::tag('priority', [], $priority);
        if ($lastmod) {
            $res .= CHtml::tag('lastmod', [], SitemapHelper::dateToW3C($lastmod));
        }
        $res .= CHtml::closeTag('url');

        return $res;
    }
}


text:
from setuptools import setup

setup(
    name='gzip-reader',
    version='0.1',
    author='Alexander Schepanovski',
    author_email='suor.web@gmail.com',

    description='Decompress gzipped streams on the fly',
    long_description=open('README.rst').read(),
    url='http://github.com/Suor/gzip-reader',
    license='BSD',

    py_modules=['gzip_reader'],

    classifiers=[
        'Development Status :: 4 - Beta',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: Implementation :: CPython',

        'Topic :: Software Development :: Libraries :: Python Modules',
        'Intended Audience :: Developers',
    ]
)


text:
require 'fastlane/plugin/carthage_cache/version'

module Fastlane
  module CarthageCache
    # Return all .rb files inside the "actions" and "helper" directory
    def self.all_classes
      Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
    end
  end
end

# By default we want to import all available actions and helpers
# A plugin can contain any number of actions and plugins
Fastlane::CarthageCache.all_classes.each do |current|
  require current
end


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 System.Collections.Immutable
Imports System.Runtime.InteropServices
Imports System.Text.RegularExpressions
Imports Microsoft.CodeAnalysis.Collections
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports TypeKind = Microsoft.CodeAnalysis.TypeKind

Namespace Microsoft.CodeAnalysis.VisualBasic

    Friend Partial Class Binder
        Private Function BindObjectCreationExpression(
            node As ObjectCreationExpressionSyntax,
            diagnostics As DiagnosticBag
        ) As BoundExpression
            Dim type As TypeSymbol = Me.BindTypeSyntax(node.Type, diagnostics)

            ' When the type is an error still try to bind the arguments for better data flow analysis and
            ' to permit them to be analyzed via the binding API.
            If type.IsErrorType() Then

                Dim extendedErrorType = TryCast(type, ExtendedErrorTypeSymbol)

                If extendedErrorType IsNot Nothing AndAlso extendedErrorType.CandidateSymbols.Length = 1 AndAlso
                   extendedErrorType.CandidateSymbols(0).Kind = SymbolKind.NamedType Then
                    ' Continue binding with candidate symbol as the target type, but suppress any additional diagnostics
                    type = DirectCast(extendedErrorType.CandidateSymbols(0), TypeSymbol)
                    diagnostics = New DiagnosticBag()
                Else
                    Dim argumentDiagnostics = DiagnosticBag.GetInstance()
                    Dim boundArguments As ImmutableArray(Of BoundExpression) = Nothing
                    Dim argumentNames As ImmutableArray(Of String) = Nothing
                    Dim argumentNamesLocations As ImmutableArray(Of Location) = Nothing

                    BindArgumentsAndNames(node.ArgumentList, boundArguments, argumentNames, argumentNamesLocations, argumentDiagnostics)

                    ' We also want to put into the bound bad expression node all bound arguments as
                    ' r-values AND bound type which will be used for semantic info
                    Dim boundNodes = ArrayBuilder(Of BoundNode).GetInstance()

                    ' Add all bound arguments as r-values
                    For Each arg In boundArguments
                        boundNodes.Add(MakeRValueAndIgnoreDiagnostics(arg))
                    Next

                    Dim boundInitializer As BoundExpression =
                        BindObjectCollectionOrMemberInitializer(node, type, Nothing, argumentDiagnostics)
                    If boundInitializer IsNot Nothing Then
                        boundNodes.Add(boundInitializer)
                    End If

                    argumentDiagnostics.Free()

                    Return BadExpression(node, boundNodes.ToImmutableAndFree(), type)
                End If
            End If

            Return BindObjectCreationExpression(node.Type, node.ArgumentList, type, node, diagnostics, Nothing)
        End Function

        Friend Function BindObjectCreationExpression(
            typeNode As TypeSyntax,
            argumentListOpt As ArgumentListSyntax,
            type0 As TypeSymbol,
            node As ObjectCreationExpressionSyntax,
            diagnostics As DiagnosticBag,
            asNewVariablePlaceholderOpt As BoundWithLValueExpressionPlaceholder
        ) As BoundExpression

            Select Case type0.TypeKind
                Case TypeKind.Delegate
                    ' delegate creations need to handled differently.
                    Return BindDelegateCreationExpression(type0, argumentListOpt, node, diagnostics)

                Case TypeKind.Structure
                    ' SPECIAL CASE: process calls to a parameterless structure constructors separately
                    If argumentListOpt Is Nothing OrElse argumentListOpt.Arguments.Count = 0 Then
                        ' Skip overload resolution, go straight to the structure parameterless constructor if exists
                        Dim constructorSymbol As MethodSymbol = Nothing

                        ' NOTE: in case the structure has a constructor with all optional parameters
                        '       we don't catch it here; this matches Dev10 behavior

                        Dim ctors = DirectCast(type0, NamedTypeSymbol).InstanceConstructors

                        If Not ctors.IsEmpty Then
                            For Each constructor In ctors
                                If constructor.ParameterCount = 0 Then
                                    '  the first parameterless constructor will do the job
                                    Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
                                    If IsAccessible(constructor, useSiteDiagnostics) Then
                                        ' if not accessible, just clear symbol information
                                        constructorSymbol = constructor
                                        ReportUseSiteError(diagnostics, node, constructorSymbol)
                                    End If

                                    diagnostics.Add(node, useSiteDiagnostics)
                                    Exit For
                                End If
                            Next
                        End If

                        ' NOTE: we don't report an error if the constructor is inaccessible.
                        '       Emitter will just emit 'initobj' instead of constructor call instead

                        '  create a simplified object creation expression
                        Return New BoundObjectCreationExpression(
                                        node,
                                        constructorSymbol,
                                        If(constructorSymbol Is Nothing,
                                           Nothing,
                                           New BoundMethodGroup(typeNode, Nothing,
                                                             ImmutableArray.Create(constructorSymbol), LookupResultKind.Good, Nothing,
                                                             QualificationKind.QualifiedViaTypeName)),
                                        ImmutableArray(Of BoundExpression).Empty,
                                        BindObjectCollectionOrMemberInitializer(node,
                                                                                type0,
                                                                                asNewVariablePlaceholderOpt,
                                                                                diagnostics),
                                        type0)
                    End If

            End Select

            ' Get the bound arguments and the argument names.
            Dim boundArguments As ImmutableArray(Of BoundExpression) = Nothing
            Dim argumentNames As ImmutableArray(Of String) = Nothing
            Dim argumentNamesLocations As ImmutableArray(Of Location) = Nothing

            BindArgumentsAndNames(argumentListOpt, boundArguments, argumentNames, argumentNamesLocations, diagnostics)

            Dim objectInitializerExpression = BindObjectCollectionOrMemberInitializer(node,
                                                                                type0,
                                                                                asNewVariablePlaceholderOpt,
                                                                                diagnostics)
            Return BindObjectCreationExpression(typeNode,
                                                argumentListOpt,
                                                type0,
                                                node,
                                                boundArguments,
                                                argumentNames,
                                                objectInitializerExpression,
                                                diagnostics,
                                                callerInfoOpt:=typeNode)
        End Function

        Friend Function BindObjectCreationExpression(
            syntax As VisualBasicSyntaxNode,
            type As TypeSymbol,
            arguments As ImmutableArray(Of BoundExpression),
            diagnostics As DiagnosticBag) As BoundExpression
            Return BindObjectCreationExpression(
                typeNode:=syntax,
                argumentListOpt:=Nothing,
                type0:=type,
                node:=syntax,
                boundArguments:=arguments,
                argumentNames:=Nothing,
                objectInitializerExpressionOpt:=Nothing,
                diagnostics:=diagnostics,
                callerInfoOpt:=Nothing)
        End Function

        Private Function MergeBoundChildNodesWithObjectInitializerForBadNode(
            boundArguments As ImmutableArray(Of BoundExpression),
            objectInitializerExpression As BoundObjectInitializerExpressionBase
        ) As ImmutableArray(Of BoundNode)
            Dim boundChildNodesForError = StaticCast(Of BoundNode).From(boundArguments)

            If objectInitializerExpression IsNot Nothing Then
                boundChildNodesForError = boundChildNodesForError.Add(objectInitializerExpression)
            End If

            Return boundChildNodesForError
        End Function

        Private Function BindObjectCreationExpression(
            typeNode As VisualBasicSyntaxNode,
            argumentListOpt As ArgumentListSyntax,
            type0 As TypeSymbol,
            node As VisualBasicSyntaxNode,
            boundArguments As ImmutableArray(Of BoundExpression),
            argumentNames As ImmutableArray(Of String),
            objectInitializerExpressionOpt As BoundObjectInitializerExpressionBase,
            diagnostics As DiagnosticBag,
            callerInfoOpt As VisualBasicSyntaxNode
        ) As BoundExpression

            Dim resultKind As LookupResultKind = LookupResultKind.Good
            Dim errorReported As Boolean = False        ' was an error already reported?
            Dim type As NamedTypeSymbol = Nothing

            Debug.Assert(objectInitializerExpressionOpt Is Nothing OrElse objectInitializerExpressionOpt.Type = type0)

            Select Case type0.TypeKind
                Case TypeKind.Class
                    If DirectCast(type0, NamedTypeSymbol).IsMustInherit Then
                        ReportDiagnostic(diagnostics, node, ERRID.ERR_NewOnAbstractClass)
                        resultKind = LookupResultKind.NotCreatable
                        errorReported = True
                    End If

                    type = DirectCast(type0, NamedTypeSymbol)

                Case TypeKind.Interface
                    Dim coClass As TypeSymbol = DirectCast(type0, NamedTypeSymbol).CoClassType
                    Dim diagInfo As DiagnosticInfo
                    If coClass IsNot Nothing Then

                        Select Case coClass.TypeKind
                            Case TypeKind.Error,
                                 TypeKind.Interface

                                ' Generate basic missing CoClass error
                                ' Note the same error of interfaces specified as CoClasses
                                diagInfo = ErrorFactory.ErrorInfo(ERRID.ERR_CoClassMissing2, coClass, type0)

                            Case TypeKind.Array
                                ' NOTE: In case of array type in CoClass Dev11 generates a call to
                                '       Array's element type constructor which does not make any
                                '       sense, we treat this case as a 'invalid-coclass' error
                                diagInfo = ErrorFactory.ErrorInfo(ERRID.ERR_InvalidCoClass1, coClass)

                            Case TypeKind.Class,
                                 TypeKind.Delegate,
                                 TypeKind.Enum,
                                 TypeKind.Module,
                                 TypeKind.Structure

                                ' NOTE: Dev11 does not 'see' implicit parameterless constructors in structs
                                ' NOTE: and enums while Roslyn does. This means that some edge case scenarios
                                ' NOTE: of struct/enum CoClass types now work

                                Dim namedCoClass = DirectCast(coClass, NamedTypeSymbol)
                                If namedCoClass.IsUnboundGenericType Then
                                    ' Cannot use unbound generic type as a CoClass
                                    diagInfo = ErrorFactory.ErrorInfo(ERRID.ERR_InvalidCoClass1, coClass)
                                    Exit Select
                                End If

                                ' Check accessibility
                                Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
                                Dim isInAccessible As Boolean = (Me.CheckAccessibility(namedCoClass, useSiteDiagnostics) <> AccessCheckResult.Accessible)
                                diagnostics.Add(node, useSiteDiagnostics)

                                If isInAccessible Then
                                    ' CoClass is inaccessible
                                    diagInfo = ErrorFactory.ErrorInfo(ERRID.ERR_InAccessibleCoClass3, coClass, type0, coClass.DeclaredAccessibility.ToDiagnosticString())
                                    Exit Select
                                End If

                                ' NoPIA support
                                If type0.ContainingAssembly.IsLinked Then
                                    Return BindNoPiaObjectCreationExpression(node, type0, namedCoClass, boundArguments, objectInitializerExpressionOpt, diagnostics)
                                End If

                                If namedCoClass.IsMustInherit Then
                                    ' NOTE: Dev11 does allow abstract classes to serve as a CoClass
                                    ' NOTE: types and generates not verifiable code as a result
                                    diagInfo = ErrorFactory.ErrorInfo(ERRID.ERR_InvalidCoClass1, coClass)
                                    Exit Select
                                End If

                                type = namedCoClass
                                diagInfo = Nothing

                            Case Else
                                Throw ExceptionUtilities.UnexpectedValue(coClass.TypeKind)
                        End Select

                    Else
                        diagInfo = ErrorFactory.ErrorInfo(ERRID.ERR_NewIfNullOnNonClass)
                    End If

                    If diagInfo IsNot Nothing Then
                        ReportDiagnostic(diagnostics, node, diagInfo)
                        resultKind = LookupResultKind.NotCreatable
                        errorReported = True
                        type = DirectCast(type0, NamedTypeSymbol)
                    End If

                Case TypeKind.Error
                    Return New BoundBadExpression(node, LookupResultKind.Empty,
                                                  ImmutableArray(Of Symbol).Empty,
                                                  MergeBoundChildNodesWithObjectInitializerForBadNode(boundArguments,
                                                                                objectInitializerExpressionOpt),
                                                  type0, hasErrors:=True)

                Case TypeKind.TypeParameter
                    Dim typeParameter = DirectCast(type0, TypeParameterSymbol)

                    If Not typeParameter.HasConstructorConstraint AndAlso Not typeParameter.IsValueType Then
                        ' "'New' cannot be used on a type parameter that does not have a 'New' constraint."
                        ReportDiagnostic(diagnostics, typeNode, ERRID.ERR_NewIfNullOnGenericParam)

                    ElseIf Not boundArguments.IsEmpty Then
                        ' "Arguments cannot be passed to a 'New' used on a type parameter."
                        Dim span = argumentListOpt.Arguments.Span
                        ReportDiagnostic(diagnostics, GetLocation(span), ERRID.ERR_NewArgsDisallowedForTypeParam)

                    Else
                        Return New BoundNewT(node,
                                             objectInitializerExpressionOpt,
                                             typeParameter)
                    End If

                    resultKind = LookupResultKind.NotCreatable
                    errorReported = True

                Case TypeKind.Enum, TypeKind.Structure
                    type = DirectCast(type0, NamedTypeSymbol)

                Case TypeKind.Module
                    ' the diagnostic that a module cannot be used as a type has already been reported
                    ' so there is nothing to do here.
                    type = DirectCast(type0, NamedTypeSymbol)
                    resultKind = LookupResultKind.NotCreatable
                    errorReported = True

                Case TypeKind.Array
                    ' the diagnostic that AsNew cannot be used to init arrays has already been reported
                    ' so there is nothing to do here.
                    resultKind = LookupResultKind.NotCreatable
                    errorReported = True

                Case Else
                    Throw ExceptionUtilities.UnexpectedValue(type0.TypeKind)

            End Select

            ' TODO: handle cases of types that are not newable (see type libraries and the
            ' System.Runtime.InteropServices.TypeLibType attribute).
            ' example:
            ' <System.Runtime.InteropServices.TypeLibType(System.Runtime.InteropServices.TypeLibTypeFlags.FHidden)>
            ' Class test
            ' End Class

            ' Filter out inaccessible constructors
            Dim resultExpression As BoundExpression
            Dim constructorsGroup As BoundMethodGroup = Nothing

            If type IsNot Nothing AndAlso Not type.IsInterface Then
                Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
                Dim constructors As ImmutableArray(Of MethodSymbol) = GetAccessibleConstructors(type, useSiteDiagnostics)

                diagnostics.Add(node, useSiteDiagnostics)

                Dim groupResultKind As LookupResultKind = LookupResultKind.Good

                If constructors.Length = 0 Then
                    constructors = type.InstanceConstructors
                    groupResultKind = LookupResultKind.Inaccessible
                End If

                If constructors.Length > 0 Then
                    constructorsGroup = New BoundMethodGroup(typeNode, Nothing,
                                                             constructors, groupResultKind, Nothing,
                                                             QualificationKind.QualifiedViaTypeName).MakeCompilerGenerated()
                End If
            End If

            If constructorsGroup Is Nothing OrElse constructorsGroup.ResultKind = LookupResultKind.Inaccessible Then
                If Not errorReported Then
                    ReportDiagnostic(diagnostics, If(typeNode.IsKind(SyntaxKind.QualifiedName), DirectCast(typeNode, QualifiedNameSyntax).Right, typeNode), ErrorFactory.ErrorInfo(ERRID.ERR_NoViableOverloadCandidates1, "New"))
                End If

                ' Suppress any additional diagnostics
                diagnostics = New DiagnosticBag()
            End If

            If constructorsGroup Is Nothing Then
                resultExpression = New BoundBadExpression(node, LookupResult.WorseResultKind(resultKind, LookupResultKind.Empty),
                                                          ImmutableArray(Of Symbol).Empty,
                                                          MergeBoundChildNodesWithObjectInitializerForBadNode(boundArguments,
                                                                                objectInitializerExpressionOpt),
                                                          type0, hasErrors:=True)
            Else
                ' We rely on the asserted condition when we are merging/changing result kinds below.
                Debug.Assert(constructorsGroup.ResultKind = LookupResultKind.Good OrElse constructorsGroup.ResultKind = LookupResultKind.Inaccessible)

                Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
                Dim results As OverloadResolution.OverloadResolutionResult = OverloadResolution.MethodInvocationOverloadResolution(constructorsGroup,
                                                                                boundArguments,
                                                                                argumentNames,
                                                                                Me,
                                                                                callerInfoOpt,
                                                                                useSiteDiagnostics)

                If diagnostics.Add(node, useSiteDiagnostics) Then
                    If constructorsGroup.ResultKind <> LookupResultKind.Inaccessible Then
                        ' Suppress additional diagnostics
                        diagnostics = New DiagnosticBag()
                    End If
                End If

                If Not results.BestResult.HasValue Then

                    ' Create and report the diagnostic.
                    If results.Candidates.Length = 0 Then
                        results = OverloadResolution.MethodInvocationOverloadResolution(constructorsGroup, boundArguments, argumentNames, Me, includeEliminatedCandidates:=True, callerInfoOpt:=callerInfoOpt,
                                                                                useSiteDiagnostics:=useSiteDiagnostics)
                    End If

                    ' NOTE: current services implementation expects all diagnostics to be associated with type node, not with a node itself
                    resultExpression = ReportOverloadResolutionFailureAndProduceBoundNode(node,
                                                                                constructorsGroup,
                                                                                boundArguments, argumentNames,
                                                                                results, diagnostics, callerInfoOpt,
                                                                                overrideCommonReturnType:=type0)

                    ' update the bad expression to also contain the bound initializer.
                    Dim badExpression = DirectCast(resultExpression, BoundBadExpression)

                    ' Here we have possibly three different LookupResultKinds to store
                    ' 1) LookupResultKind.NotCreatable - if the type is not creatable
                    ' 2) LookupResultKind.OverloadResolutionFailure
                    ' 3) LookupResultKind from constructorsGroup

                    ' Let's preserve two worst since we only have two locations to store them.
                    Dim children = ArrayBuilder(Of BoundNode).GetInstance()

#If DEBUG Then
                    Dim foundGroup As Boolean = False
#End If

                    For Each child In badExpression.ChildBoundNodes
                        If child Is constructorsGroup Then
#If DEBUG Then
                            foundGroup = True
#End If
                            children.Add(constructorsGroup.Update(constructorsGroup.TypeArgumentsOpt, constructorsGroup.Methods, constructorsGroup.PendingExtensionMethodsOpt,
                                                                  LookupResult.WorseResultKind(constructorsGroup.ResultKind, badExpression.ResultKind), constructorsGroup.ReceiverOpt,
                                                                  constructorsGroup.QualificationKind))
                        Else
                            children.Add(child)
                        End If
                    Next

#If DEBUG Then
                    Debug.Assert(foundGroup)
#End If

                    If objectInitializerExpressionOpt IsNot Nothing Then
                        children.Add(objectInitializerExpressionOpt)
                    End If

                    resultExpression = badExpression.Update(LookupResult.WorseResultKind(resultKind, badExpression.ResultKind),
                                                            badExpression.Symbols,
                                                            children.ToImmutableAndFree(),
                                                            badExpression.Type)
                Else

                    Dim methodResult = results.BestResult.Value

                    boundArguments = PassArguments(typeNode, methodResult, boundArguments, diagnostics)

                    ReportDiagnosticsIfObsolete(diagnostics, methodResult.Candidate.UnderlyingSymbol, node)

                    ' If a coclass was instantiated, convert the class to the interface type.
                    If type0.IsInterfaceType() Then
                        Debug.Assert(type.Equals(DirectCast(type0, NamedTypeSymbol).CoClassType))
                        ApplyImplicitConversion(node, type0, New BoundRValuePlaceholder(node, type), diagnostics)
                    Else
                        Debug.Assert(type = type0)
                    End If

                    ' If the type was not creatable, create a bad expression so that semantic model results can reflect that.
                    If resultKind <> LookupResultKind.Good Then
                        Dim children = ArrayBuilder(Of BoundNode).GetInstance()

                        children.Add(constructorsGroup)
                        children.AddRange(boundArguments)

                        If objectInitializerExpressionOpt IsNot Nothing Then
                            children.Add(objectInitializerExpressionOpt)
                        End If

                        resultExpression = New BoundBadExpression(node, resultKind,
                                                                  ImmutableArray.Create(Of Symbol)(methodResult.Candidate.UnderlyingSymbol),
                                                                  children.ToImmutableAndFree(),
                                                                  type0, hasErrors:=True)
                    Else
                        resultExpression = New BoundObjectCreationExpression(node,
                                                                             DirectCast(methodResult.Candidate.UnderlyingSymbol, MethodSymbol),
                                                                             constructorsGroup,
                                                                             boundArguments,
                                                                             objectInitializerExpressionOpt,
                                                                             type0)
                    End If
                End If
            End If

            Debug.Assert(resultExpression.Type.IsSameTypeIgnoringCustomModifiers(type0))
            Debug.Assert(LookupResult.WorseResultKind(resultKind, resultExpression.ResultKind) = resultExpression.ResultKind)

            Return resultExpression
        End Function

        Private Function BindNoPiaObjectCreationExpression(
            node As VisualBasicSyntaxNode,
            [interface] As TypeSymbol,
            coClass As NamedTypeSymbol,
            boundArguments As ImmutableArray(Of BoundExpression),
            initializerOpt As BoundObjectInitializerExpressionBase,
            diagnostics As DiagnosticBag
        ) As BoundExpression
            Dim hasErrors = False

            Dim guidString As String = Nothing
            If Not coClass.GetGuidString(guidString) Then
                ' Match Dev11 VB by reporting ERRID_NoPIAAttributeMissing2 if guid isn't there.
                ' C# doesn't complain and instead uses zero guid.
                ReportDiagnostic(diagnostics, node, ERRID.ERR_NoPIAAttributeMissing2, coClass, AttributeDescription.GuidAttribute.FullName)
                hasErrors = True
            End If

            Dim expr = New BoundNoPiaObjectCreationExpression(node, guidString, initializerOpt, [interface], hasErrors)

            If boundArguments.Any() Then
                ' Note: Dev11 silently drops any arguments and does not report an error.
                ReportDiagnostic(diagnostics, node, ERRID.ERR_NoArgumentCountOverloadCandidates1, "New")

                Dim children = ArrayBuilder(Of BoundNode).GetInstance()
                children.AddRange(boundArguments)
                children.Add(expr)
                Return BadExpression(node, children.ToImmutableAndFree(), expr.Type)
            End If

            Return expr
        End Function

        ''' <summary>
        ''' Binds the object collection or member initializer from a object creation.
        ''' E.g. "new CollType() From {...}" or "new AType() With {...}"
        ''' </summary>
        ''' <param name="initializedObjectType">The type of the created object expression.</param>
        ''' <param name="syntaxNode">The object creation expression syntax.</param>
        ''' <param name="diagnostics">The diagnostics.</param>
        Private Function BindObjectCollectionOrMemberInitializer(
            syntaxNode As ObjectCreationExpressionSyntax,
            initializedObjectType As TypeSymbol,
            asNewVariablePlaceholderOpt As BoundWithLValueExpressionPlaceholder,
            diagnostics As DiagnosticBag
        ) As BoundObjectInitializerExpressionBase

            If syntaxNode.Initializer Is Nothing Then
                Return Nothing
            End If

            If syntaxNode.Initializer.Kind = SyntaxKind.ObjectMemberInitializer Then
                Return BindObjectInitializer(syntaxNode, initializedObjectType, asNewVariablePlaceholderOpt, diagnostics)

            ElseIf syntaxNode.Initializer.Kind = SyntaxKind.ObjectCollectionInitializer Then
                Return BindCollectionInitializer(syntaxNode, initializedObjectType, diagnostics)

            Else
                Throw ExceptionUtilities.UnexpectedValue(syntaxNode.Initializer.Kind)
            End If
        End Function

        ''' <summary>
        ''' Bind the ObjectInitializer.
        ''' During the binding we basically bind the member access for each initializer, as well as the value that will be assigned.
        ''' The main information stored in the bound node is a list of assignment operators (that may contain placeholders), as
        ''' well as the information whether expression creates a temporary or not.
        ''' </summary>
        Private Function BindObjectInitializer(
            objectCreationSyntax As ObjectCreationExpressionSyntax,
            initializedObjectType As TypeSymbol,
            asNewVariablePlaceholderOpt As BoundWithLValueExpressionPlaceholder,
            diagnostics As DiagnosticBag
        ) As BoundObjectInitializerExpression

            Dim memberInitializerSyntax = DirectCast(objectCreationSyntax.Initializer, ObjectMemberInitializerSyntax)

            ' We need to use a declared variable directly if it is declared using AsNew and it's type is a value type or a type
            ' parameter with a structure constraint.
            ' Otherwise the object initializer should initialize a temporary.
            ' According to Jonathan Aneja this is a bug and should always use a temporary, but unfortunately it's what Dev10 emits
            ' (we have legacy tests that check this specifically).
            Dim createTemporary = asNewVariablePlaceholderOpt Is Nothing OrElse Not initializedObjectType.IsValueType

            Dim variableOrTempPlaceholder As BoundWithLValueExpressionPlaceholder = Nothing
            If createTemporary Then
                variableOrTempPlaceholder = New BoundWithLValueExpressionPlaceholder(objectCreationSyntax, initializedObjectType)
                variableOrTempPlaceholder.SetWasCompilerGenerated()
            Else
                Debug.Assert(asNewVariablePlaceholderOpt IsNot Nothing)
                variableOrTempPlaceholder = asNewVariablePlaceholderOpt
            End If

            Dim objectInitializerBinder = New ObjectInitializerBinder(Me, variableOrTempPlaceholder)

            ' bind RHS for error cases.
            If initializedObjectType.SpecialType = SpecialType.System_Object OrElse initializedObjectType.IsErrorType Then
                ' VB Spec 11.10.1:
                ' "the member access will not be late bound if the type being constructed is Object"
                If initializedObjectType.SpecialType = SpecialType.System_Object Then
                    ' BC30994: Object initializer syntax cannot be used to initialize an instance of 'System.Object'.
                    ReportDiagnostic(diagnostics, memberInitializerSyntax, ErrorFactory.ErrorInfo(ERRID.ERR_AggrInitInvalidForObject))
                End If

                ' Bind RHS of the assignments for the sake of error reporting
                Dim initializerCount = memberInitializerSyntax.Initializers.Count
                Dim boundAssignmentValues(initializerCount - 1) As BoundExpression
                For fieldIndex = 0 To initializerCount - 1
                    Dim boundValue = objectInitializerBinder.BindValue(DirectCast(memberInitializerSyntax.Initializers(fieldIndex),
                                                                                NamedFieldInitializerSyntax).Expression,
                                                                       diagnostics)
                    boundAssignmentValues(fieldIndex) = MakeRValueAndIgnoreDiagnostics(boundValue)
                Next

                Return New BoundObjectInitializerExpression(objectCreationSyntax.Initializer,
                                                            True,
                                                            Me,
                                                            variableOrTempPlaceholder,
                                                            boundAssignmentValues.AsImmutableOrNull,
                                                            initializedObjectType,
                                                            hasErrors:=True)
            End If

            Dim processedMembers As New HashSet(Of String)(CaseInsensitiveComparison.Comparer)
            Dim memberAssignments = ArrayBuilder(Of BoundExpression).GetInstance

            ' The temporary diagnostic bag is needed to collect diagnostics until it is known that the accessed symbol
            ' is a field or property, and if so, if it is shared or not.
            ' The temporary error messages should only be shown if binding the member access itself failed, or the bound
            ' member access is usable for the initialization (non shared, writeable field or property).
            ' Otherwise more specific diagnostics will be shown .
            Dim memberBindingDiagnostics = DiagnosticBag.GetInstance

            For Each fieldInitializer In memberInitializerSyntax.Initializers
                ' NamedFieldInitializerSyntax is derived from FieldInitializerSyntax, which has this optional keyword as a member
                ' however it should not be set in case of a NamedFieldInitializerSyntax
                Debug.Assert(fieldInitializer.KeyKeyword.Kind <> SyntaxKind.KeyKeyword)

                Dim target As BoundExpression
                Dim namedFieldInitializer = DirectCast(fieldInitializer, NamedFieldInitializerSyntax)
                Dim fieldName As IdentifierNameSyntax = namedFieldInitializer.Name

                ' we're only binding the target if there were no previous diagnostics on the identifier.
                ' In that case binding the target would always fail.
                If Not fieldName.HasErrors Then

                    ' no need to use the memberInitializerBinder here, because there is no MemberAccessExpression
                    target = BindMemberAccess(fieldName, variableOrTempPlaceholder, fieldName, False, False, memberBindingDiagnostics)
                    diagnostics.AddRange(memberBindingDiagnostics)

                    Dim identifierName As String = fieldName.Identifier.ValueText

                    If target.Kind = BoundKind.FieldAccess OrElse target.Kind = BoundKind.PropertyGroup Then
                        target = BindAssignmentTarget(fieldName,
                                                      target,
                                                      diagnostics)

                        If Not target.HasErrors Then
                            Dim isShared As Boolean
                            If target.Kind = BoundKind.FieldAccess Then
                                isShared = DirectCast(target, BoundFieldAccess).FieldSymbol.IsShared
                            Else
                                Dim [property] = DirectCast(target, BoundPropertyAccess).PropertySymbol
                                ' Treat extension properties as Shared in this context so we generate
                                ' an error (BC30991) that such properties cannot be used in an initializer.
                                ' Currently, there is only one extension property, InternalXmlHelper.Value:
                                ' e.g.: New List(Of XElement) With {.Value = Nothing}. Consider a specific
                                ' error for extension properties if this scenario is more common.
                                isShared = ([property].ReducedFrom IsNot Nothing) OrElse [property].IsShared
                            End If

                            If isShared Then
                                ' report that initializing shared members is not supported
                                ' BC30991: Member '{0}' cannot be initialized in an object initializer expression because it is shared.
                                ReportDiagnostic(diagnostics,
                                                 fieldName,
                                                 ErrorFactory.ErrorInfo(ERRID.ERR_SharedMemberAggrMemberInit1, identifierName))
                            Else
                                ' each field can only be initialized once.
                                ' only do this if the target did not show errors, to reduce noise
                                If Not processedMembers.Add(identifierName) Then
                                    ReportDiagnostic(diagnostics,
                                                     fieldName,
                                                     ErrorFactory.ErrorInfo(ERRID.ERR_DuplicateAggrMemberInit1, identifierName))
                                End If
                            End If
                        End If
                    Else
                        ' if the node already had diagnostics, report these, otherwise report that the accessed member
                        ' is not a field or property.
                        If Not memberBindingDiagnostics.HasAnyErrors Then
                            ' BC30990: Member '{0}' cannot be initialized in an object initializer expression because it is not a field or property.
                            ReportDiagnostic(diagnostics,
                                             fieldName,
                                             ErrorFactory.ErrorInfo(ERRID.ERR_NonFieldPropertyAggrMemberInit1, identifierName))
                        End If

                        target = BadExpression(namedFieldInitializer,
                                               target,
                                               LookupResultKind.Empty,
                                               ErrorTypeSymbol.UnknownResultType)
                    End If
                Else
                    target = BadExpression(namedFieldInitializer, ErrorTypeSymbol.UnknownResultType)
                End If

                ' in contrast to Dev10 Roslyn continues to bind the initialization value even if the receiver had errors.
                Dim value = objectInitializerBinder.BindValue(namedFieldInitializer.Expression, diagnostics)
                ' no need to apply an implicit conversion here, this will be done in BindAssignment

                Dim assignmentOperator As BoundExpression = BindAssignment(namedFieldInitializer, target, value, diagnostics)
                memberAssignments.Add(assignmentOperator)

                ' assert that the conversion really happened.
                Debug.Assert(DirectCast(memberAssignments.Last, BoundAssignmentOperator).Right.Type = DirectCast(memberAssignments.Last, BoundAssignmentOperator).Left.Type)

                memberBindingDiagnostics.Clear()
            Next

            memberBindingDiagnostics.Free()

            Return New BoundObjectInitializerExpression(objectCreationSyntax.Initializer,
                                                        createTemporary,
                                                        Me,
                                                        variableOrTempPlaceholder,
                                                        memberAssignments.ToImmutableAndFree,
                                                        initializedObjectType)
        End Function

        ''' <summary>
        ''' Binds a object collection initializer.
        ''' During the binding of this node we are binding calls to Add methods of the created object. Once the "collection"
        ''' type passed the requirements (same as for each collection requirements + must have accessible Add method), all
        ''' diagnostics are handled by the overload resolution.
        ''' The bound node contains a list of call expressions (that may contain placeholders).
        ''' </summary>
        Private Function BindCollectionInitializer(
            objectCreationSyntax As ObjectCreationExpressionSyntax,
            initializedObjectType As TypeSymbol,
            diagnostics As DiagnosticBag
        ) As BoundCollectionInitializerExpression

            Dim collectionInitializerSyntax = DirectCast(objectCreationSyntax.Initializer, ObjectCollectionInitializerSyntax)
            Dim collectionType = initializedObjectType

            Dim unusedType As TypeSymbol = Nothing
            Dim unusedExpression As BoundExpression = Nothing
            Dim unusedLValuePlaceholder As BoundLValuePlaceholder = Nothing
            Dim unusedRValuePlaceholder As BoundRValuePlaceholder = Nothing
            Dim temporaryDiagnostics = DiagnosticBag.GetInstance
            Dim matchesDesignPattern As Boolean = False

            ' From Dev10:
            ' Verification of collection type: first we ensure that the collection type really is a collection, i.e.
            ' basically that once we've created the collection then people will be able to "for each" over it.
            ' lwischik: WHY? All we're doing is invoking the "Add" method on something. Why even care
            ' that people can enumerate it afterwards? Was this intended to support "new Collection from MyEnumerable"?
            ' But here we're checking the collection pNewExpression, rather than "From" expression pInput->Initializer...
            ' Answer: that's what the decision was when the spec was designed. The motive was that this "From"
            ' is really intended to be used for collections, and not just for arbitrary classes that happen
            ' to have an "Add" method.

            ' Spec 10.9 (this comment is in answer to bug Dev10#531849): a type is considered a collection type if
            '    (1) it satisfies MatchesForEachCollectionDesignPattern (i.e. has a method named GetEnumerator() which
            '        returns a type with MoveNext/Current); or
            '    (2) it implements System.Collections.Generic.IEnumerable(Of T); or
            '    (3) it implements System.Collections.IEnumerable.
            If MatchesForEachCollectionDesignPattern(collectionType,
                                                     New BoundRValuePlaceholder(collectionInitializerSyntax, initializedObjectType),
                                                     unusedType,
                                                     unusedExpression,
                                                     unusedLValuePlaceholder,
                                                     unusedExpression,
                                                     unusedExpression,
                                                     unusedRValuePlaceholder,
                                                     temporaryDiagnostics) Then
                diagnostics.AddRange(temporaryDiagnostics)
                matchesDesignPattern = True

            Else
                Dim ienumerableUseSiteDiagnostics = DiagnosticBag.GetInstance
                Dim ienumerable = GetSpecialType(SpecialType.System_Collections_IEnumerable,
                                                 objectCreationSyntax,
                                                 ienumerableUseSiteDiagnostics)

                Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
                If IsOrInheritsFromOrImplementsInterface(collectionType, ienumerable, useSiteDiagnostics) Then
                    diagnostics.AddRange(ienumerableUseSiteDiagnostics)
                    matchesDesignPattern = True

                Else
                    ReportDiagnostic(diagnostics,
                                     collectionInitializerSyntax,
                                     ErrorFactory.ErrorInfo(ERRID.ERR_NotACollection1, collectionType.Name))
                End If

                diagnostics.Add(collectionInitializerSyntax, useSiteDiagnostics)

                ienumerableUseSiteDiagnostics.Free()
            End If

            Dim result = LookupResult.GetInstance
            temporaryDiagnostics.Clear()

            GetMemberIfMatchesRequirements(WellKnownMemberNames.CollectionInitializerAddMethodName,
                                           collectionType,
                                           Function(y As Symbol) As Boolean
                                               Return y.Kind = SymbolKind.Method
                                           End Function,
                                           result,
                                           collectionInitializerSyntax,
                                           temporaryDiagnostics)

            Dim initializers = collectionInitializerSyntax.Initializer.Initializers
            Dim initializerCount = initializers.Count
            Dim addInvocationExpressions As ImmutableArray(Of BoundExpression)
            Dim placeholder As BoundWithLValueExpressionPlaceholder = Nothing

            If result.IsGood Then
                diagnostics.AddRange(temporaryDiagnostics)
            ElseIf matchesDesignPattern Then
                ' the collection does not have a single accessible Add method.
                ' do not report this error if the collection did not match the design pattern
                ReportDiagnostic(diagnostics,
                                 collectionInitializerSyntax,
                                 ErrorFactory.ErrorInfo(ERRID.ERR_NoAddMethod1, collectionType))
            End If

            temporaryDiagnostics.Free()

            ' As long as there is a least one accessible Add method we will accept the collection and start
            ' binding call expressions with the given arguments. All error reporting will now come from the
            ' overload resolution.

            Dim addInvocations(initializerCount - 1) As BoundExpression

            ' iterate over the top level initializers.
            placeholder = New BoundWithLValueExpressionPlaceholder(objectCreationSyntax,
                                                                   collectionType)
            placeholder.SetWasCompilerGenerated()

            For initializerIndex = 0 To initializerCount - 1
                addInvocations(initializerIndex) = BindCollectionInitializerElement(initializers(initializerIndex),
                                                                                placeholder,
                                                                                result,
                                                                                diagnostics)
            Next

            addInvocationExpressions = addInvocations.AsImmutableOrNull
            result.Free()

            Return New BoundCollectionInitializerExpression(objectCreationSyntax.Initializer,
                                                            placeholder,
                                                            addInvocationExpressions,
                                                            collectionType)
        End Function

        ''' <summary>
        ''' Binds a call expression for a given top level object collection initializer.
        ''' </summary>
        Private Function BindCollectionInitializerElement(
            topLevelInitializer As ExpressionSyntax,
            placeholder As BoundWithLValueExpressionPlaceholder,
            result As LookupResult,
            diagnostics As DiagnosticBag
        ) As BoundExpression

            Dim arguments = ArrayBuilder(Of BoundExpression).GetInstance
            If topLevelInitializer.Kind = SyntaxKind.CollectionInitializer Then
                ' handle "... From {{1, 2, 3}, ..."
                Dim collectionInitializer = DirectCast(topLevelInitializer, CollectionInitializerSyntax)

                Dim initializers As SeparatedSyntaxList(Of ExpressionSyntax) = collectionInitializer.Initializers
                If initializers.IsEmpty Then
                    ReportDiagnostic(diagnostics, topLevelInitializer, ErrorFactory.ErrorInfo(ERRID.ERR_EmptyAggregateInitializer))
                Else
                    For Each expression In initializers
                        arguments.Add(BindValue(expression, diagnostics))
                    Next
                End If
            Else
                ' handle "... From {1, ..."
                arguments.Add(BindValue(topLevelInitializer, diagnostics))
            End If

            If result.IsGood() AndAlso Not arguments.IsEmpty Then
                Dim methodGroup As BoundMethodGroup = CreateBoundMethodGroup(topLevelInitializer,
                                                                             result,
                                                                             LookupOptions.AllMethodsOfAnyArity,
                                                                             placeholder,
                                                                             Nothing,
                                                                             QualificationKind.QualifiedViaValue)

                Dim invocation = BindInvocationExpression(topLevelInitializer, topLevelInitializer,
                                                          TypeCharacter.None,
                                                          methodGroup,
                                                          arguments.ToImmutableAndFree,
                                                          Nothing,
                                                          diagnostics,
                                                          callerInfoOpt:=topLevelInitializer)
                invocation.SetWasCompilerGenerated()

                Return invocation
            Else
                Return New BoundBadExpression(topLevelInitializer,
                                              LookupResultKind.Empty,
                                              ImmutableArray(Of Symbol).Empty,
                                              StaticCast(Of BoundNode).From(arguments.ToImmutableAndFree),
                                              ErrorTypeSymbol.UnknownResultType,
                                              hasErrors:=True).MakeCompilerGenerated()
            End If
        End Function

    End Class

    ''' <summary>
    ''' Special binder for binding ObjectInitializers.
    ''' This binder stores a reference to the receiver of the initialization, because fields in an object initializer can be
    ''' referenced with an omitted left expression in an member access expression (e.g. .Fieldname = .OtherFieldname).
    ''' </summary>
    Friend Class ObjectInitializerBinder
        Inherits Binder

        Private ReadOnly _receiver As BoundExpression

        Public Sub New(containingBinder As Binder, receiver As BoundExpression)
            MyBase.New(containingBinder)

            _receiver = receiver
        End Sub

        ''' <summary>
        ''' Use the receiver of the ObjectCreationExpression as the omitted left of a member access.
        ''' </summary>
        Protected Friend Overrides Function TryBindOmittedLeftForMemberAccess(
            node As MemberAccessExpressionSyntax,
            diagnostics As DiagnosticBag,
            accessingBinder As Binder,
            ByRef wholeMemberAccessExpressionBound As Boolean
        ) As BoundExpression

            Return _receiver
        End Function

        Protected Friend Overrides Function TryBindOmittedLeftForXmlMemberAccess(node As XmlMemberAccessExpressionSyntax, diagnostics As DiagnosticBag, accessingBinder As Binder) As BoundExpression
            Return _receiver
        End Function

        ''' <summary>
        ''' Use the receiver of the ObjectCreationExpression to as the omitted left of a dictionary access.
        ''' </summary>
        Protected Overrides Function TryBindOmittedLeftForDictionaryAccess(
                    node As MemberAccessExpressionSyntax,
                    accessingBinder As Binder,
                    diagnostics As DiagnosticBag
                ) As BoundExpression

            Return _receiver
        End Function

        Protected Overrides Function TryBindOmittedLeftForConditionalAccess(node As ConditionalAccessExpressionSyntax, accessingBinder As Binder, diagnostics As DiagnosticBag) As BoundExpression
            Return Nothing
        End Function
    End Class
End Namespace


text:
using UnityEngine;
using System.Collections;

namespace RogueNoodle
{
namespace GBCamera
{

public class RandomPalette : MonoBehaviour {

	public Texture[] _palettes;
	public Material[] _materials;
	private int _previousPaletteIndex = 0;

	public void SelectRandomPalette ()
	{
		if (_palettes.Length == 0 || _materials.Length == 0)
			return;

		int randomPaletteIndex = _previousPaletteIndex;
		while (randomPaletteIndex == _previousPaletteIndex)
		{
			randomPaletteIndex = Random.Range (0, _palettes.Length);
		}

		for (int i = 0; i < _materials.Length; i++)
		{
			_materials[i].SetTexture ("_Palette", _palettes[randomPaletteIndex]);
		}

		_previousPaletteIndex = randomPaletteIndex;
	}
}

} // GBCamera
} // RogueNoodle


text:
<?php

declare(strict_types=1);

namespace ApiPlatform\Metadata\GraphQl;

use ApiPlatform\Metadata\Link;
use ApiPlatform\Metadata\Operation as AbstractOperation;

class Operation extends AbstractOperation
{
    /**
     * @param mixed|null  $input
     * @param mixed|null  $output
     * @param mixed|null  $mercure
     * @param mixed|null  $messenger
     * @param Link[]|null $links
     */
    public function __construct(
        protected ?string $resolver = null,
        protected ?array $args = null,
        protected ?array $links = null,

        // abstract operation arguments
        ?string $shortName = null,
        ?string $class = null,
        ?bool $paginationEnabled = null,
        ?string $paginationType = null,
        ?int $paginationItemsPerPage = null,
        ?int $paginationMaximumItemsPerPage = null,
        ?bool $paginationPartial = null,
        ?bool $paginationClientEnabled = null,
        ?bool $paginationClientItemsPerPage = null,
        ?bool $paginationClientPartial = null,
        ?bool $paginationFetchJoinCollection = null,
        ?bool $paginationUseOutputWalkers = null,
        ?array $paginationViaCursor = null,
        ?array $order = null,
        ?string $description = null,
        ?array $normalizationContext = null,
        ?array $denormalizationContext = null,
        ?string $security = null,
        ?string $securityMessage = null,
        ?string $securityPostDenormalize = null,
        ?string $securityPostDenormalizeMessage = null,
        ?string $securityPostValidation = null,
        ?string $securityPostValidationMessage = null,
        ?string $deprecationReason = null,
        ?array $filters = null,
        ?array $validationContext = null,
        $input = null,
        $output = null,
        $mercure = null,
        $messenger = null,
        ?bool $elasticsearch = null,
        ?int $urlGenerationStrategy = null,
        ?bool $read = null,
        ?bool $deserialize = null,
        ?bool $validate = null,
        ?bool $write = null,
        ?bool $serialize = null,
        ?bool $fetchPartial = null,
        ?bool $forceEager = null,
        ?int $priority = null,
        ?string $name = null,
        ?string $provider = null,
        ?string $processor = null,
        array $extraProperties = []
    ) {
        // Abstract operation properties
        $this->shortName = $shortName;
        $this->class = $class;
        $this->paginationEnabled = $paginationEnabled;
        $this->paginationType = $paginationType;
        $this->paginationItemsPerPage = $paginationItemsPerPage;
        $this->paginationMaximumItemsPerPage = $paginationMaximumItemsPerPage;
        $this->paginationPartial = $paginationPartial;
        $this->paginationClientEnabled = $paginationClientEnabled;
        $this->paginationClientItemsPerPage = $paginationClientItemsPerPage;
        $this->paginationClientPartial = $paginationClientPartial;
        $this->paginationFetchJoinCollection = $paginationFetchJoinCollection;
        $this->paginationUseOutputWalkers = $paginationUseOutputWalkers;
        $this->paginationViaCursor = $paginationViaCursor;
        $this->order = $order;
        $this->description = $description;
        $this->normalizationContext = $normalizationContext;
        $this->denormalizationContext = $denormalizationContext;
        $this->security = $security;
        $this->securityMessage = $securityMessage;
        $this->securityPostDenormalize = $securityPostDenormalize;
        $this->securityPostDenormalizeMessage = $securityPostDenormalizeMessage;
        $this->securityPostValidation = $securityPostValidation;
        $this->securityPostValidationMessage = $securityPostValidationMessage;
        $this->deprecationReason = $deprecationReason;
        $this->filters = $filters;
        $this->validationContext = $validationContext;
        $this->input = $input;
        $this->output = $output;
        $this->mercure = $mercure;
        $this->messenger = $messenger;
        $this->elasticsearch = $elasticsearch;
        $this->urlGenerationStrategy = $urlGenerationStrategy;
        $this->read = $read;
        $this->deserialize = $deserialize;
        $this->validate = $validate;
        $this->write = $write;
        $this->serialize = $serialize;
        $this->fetchPartial = $fetchPartial;
        $this->forceEager = $forceEager;
        $this->priority = $priority;
        $this->name = $name;
        $this->provider = $provider;
        $this->processor = $processor;
        $this->extraProperties = $extraProperties;
    }

    public function getResolver(): ?string
    {
        return $this->resolver;
    }

    public function withResolver(?string $resolver = null): self
    {
        $self = clone $this;
        $self->resolver = $resolver;

        return $self;
    }

    public function getArgs(): ?array
    {
        return $this->args;
    }

    public function withArgs(?array $args = null): self
    {
        $self = clone $this;
        $self->args = $args;

        return $self;
    }

    /**
     * @return Link[]|null
     */
    public function getLinks(): ?array
    {
        return $this->links;
    }

    /**
     * @param Link[] $links
     */
    public function withLinks(array $links): self
    {
        $self = clone $this;
        $self->links = $links;

        return $self;
    }
}


text:
import http.client as http_client
from unittest import mock

from oslo_serialization import jsonutils
from oslo_utils import encodeutils
import webob

from senlin.api.common import wsgi
from senlin.api.openstack.v1 import version as v1_controller
from senlin.api.openstack import versions
from senlin.tests.unit.common import base

class VersionControllerTest(base.SenlinTestCase):

    def test_init(self):
        conf = mock.Mock()

        controller = versions.Controller(conf)

        self.assertIsNotNone(controller)
        self.assertEqual(conf, controller.conf)

    @mock.patch.object(v1_controller.VersionController, 'version_info')
    def test_call(self, mock_v1):
        mock_v1.return_value = {'foo': 'bar'}
        conf = mock.Mock()
        controller = versions.Controller(conf)
        environ = {
            'REQUEST_METHOD': 'GET',
            'SERVER_NAME': 'host',
            'SERVER_PORT': 8777,
            'SCRIPT_NAME': '/',
            'PATH_INFO': '/',
            'wsgi.url_scheme': 'http',
        }
        req = wsgi.Request(environ)
        expected_dict = {
            'versions': [{'foo': 'bar'}]
        }
        expected_body = jsonutils.dumps(expected_dict)

        resp = controller(req)

        self.assertIsInstance(resp, webob.Response)
        self.assertEqual(expected_body, encodeutils.safe_decode(resp.body))
        self.assertEqual(http_client.MULTIPLE_CHOICES, resp.status_code)
        self.assertEqual('application/json', resp.content_type)


text:
using LionFire.Persistence.Handles;
using LionFire.Referencing;

namespace LionFire.Persistence.Handles
{
    public class R<TValue> : ReadHandlePassthrough<TValue, IReference<TValue>>
    {
        public static implicit operator R<TValue>(string uri) => new R<TValue> { Reference = uri.ToReference<TValue>() };
        public static implicit operator R<TValue>(TValue value) => new R<TValue> { Reference = (value as IReferencableAsValueType<TValue>)?.Reference, Value = value };
    }

    public class R<TValue, TReference> : ReadHandlePassthrough<TValue, TReference>
       where TReference : IReference<TValue>
    {
        public static implicit operator R<TValue, TReference>(TReference reference)
            => new R<TValue, TReference> { Reference = reference };
        public static implicit operator R<TValue, TReference>(string uri)
            => new R<TValue, TReference> { Reference = uri.ToReferenceType<TReference>() };
        //public static implicit operator R<TValue, TReference>(TValue value)
        //=> new R<TValue, TReference> { Reference = ((IReferencable<TReference>)value).Reference, Value = value };

        public static implicit operator R<TValue, TReference>(TValue value)
        {
            if(value is IReferencable<TReference> referencable)
            {
                return new R<TValue, TReference> { Reference = referencable.Reference, Value = value };
            }
            else
            {
                return new R<TValue, TReference> { Reference = default, Value = value };
            }
        }
    }
}


text:
layout: post
title: Joyeuses Pâques !
date: 2013-03-30 10:00:17.000000000 +01:00
type: post
published: true
status: publish
categories: []
tags: []
meta:
  _edit_last: '1'
  dsq_thread_id: '1174874365'
author:
  login: admin
  email: noizat@hotmail.com
  display_name: Boussac
  first_name: ''
  last_name: ''
---

De manière assez incroyable, toutes les banques européennes ont décidé de fermer pour 4 jours (alors que l'immense majorité des entreprises, des professions libérales et des artisans travaillent vendredi) sans assurer l'acheminement des virements.

Il s'agit pourtant de simples messages électroniques qui transitent par des systèmes informatiques.

Nous devrons donc attendre sans doute mardi matin pour voir apparaître tout virement sur notre compte: des livraisons sont retardées, des commandes sont remises à mardi, toute l'activité économique du continent est ralentie pour quatre jours.

Pourquoi les opérateurs d'un système monétaire imposé se priveraient ils de partir en week end très prolongé? Par gratitude pour les 1600 milliards d'euros qu'ils ont reçus des citoyens européens ? Non: la culture du monopole l'emportera toujours chez eux.

Voilà une illustration concrète de l'inefficacité voire de l'irresponsabilité du système bancaire actuel:

alors que des "efforts" sont demandés à tous les acteurs économiques en ces temps de crise monétaire, les banques s'affranchissent une fois de plus de toute exigence.


text:
package org.assertj.db.util;

import org.assertj.db.common.AbstractTest;
import org.assertj.db.type.DateTimeValue;
import org.assertj.db.type.DateValue;
import org.assertj.db.type.TimeValue;
import org.junit.Test;

import java.sql.Date;
import java.sql.Timestamp;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Tests on {@code areEqual} method for {@code DateTimeValue}s.
 *
 * @author Régis Pouiller
 *
 */
public class Values_AreEqual_Object_And_DateTimeValue_Test extends AbstractTest {

  /**
   * This method tests the {@code areEqual} method for {@code DateTimeValue}s.
   */
  @Test
  public void test_are_equal_for_timestamps() throws Exception {
    assertThat(
            Values.areEqual(getValue(null, Timestamp.valueOf("2007-12-23 09:01:06.000000003")),
                                    DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(9, 1, 6, 3)))).isTrue();
    assertThat(
            Values.areEqual(getValue(null, Timestamp.valueOf("2007-12-23 09:01:06.000000003")),
                                    DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(9, 1, 5, 3)))).isFalse();
    assertThat(Values.areEqual(getValue(null, ""), DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(9, 1, 6, 3))))
                     .isFalse();
    assertThat(Values.areEqual(getValue(null, Timestamp.valueOf("2007-12-23 09:01:06.000000003")), (DateTimeValue) null))
                     .isFalse();

    assertThat(
            Values.areEqual(getValue(null, Timestamp.valueOf("2007-12-23 09:01:06.000000003")),
                                     DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(9, 1, 6, 2)))).isFalse();
    assertThat(
            Values.areEqual(getValue(null, Timestamp.valueOf("2007-12-23 09:01:06.000000003")),
                                     DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(9, 1, 5, 3)))).isFalse();
    assertThat(
            Values.areEqual(getValue(null, Timestamp.valueOf("2007-12-23 09:01:06.000000003")),
                                     DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(9, 2, 6, 3)))).isFalse();
    assertThat(
            Values.areEqual(getValue(null, Timestamp.valueOf("2007-12-23 09:01:06.000000003")),
                                     DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(10, 1, 6, 3)))).isFalse();
    assertThat(
            Values.areEqual(getValue(null, Timestamp.valueOf("2007-12-23 09:01:06.000000003")),
                                     DateTimeValue.of(DateValue.of(2007, 12, 3), TimeValue.of(9, 1, 6, 3)))).isFalse();
    assertThat(
            Values.areEqual(getValue(null, Timestamp.valueOf("2007-12-23 09:01:06.000000003")),
                                     DateTimeValue.of(DateValue.of(2007, 2, 23), TimeValue.of(9, 1, 6, 3)))).isFalse();
    assertThat(
            Values.areEqual(getValue(null, Timestamp.valueOf("2007-12-23 09:01:06.000000003")),
                                     DateTimeValue.of(DateValue.of(2008, 12, 23), TimeValue.of(9, 1, 6, 3)))).isFalse();

    assertThat(
        Values.areEqual(getValue(null, Date.valueOf("2007-12-23")),
            DateTimeValue.of(DateValue.of(2007, 12, 23)))).isTrue();
    assertThat(
        Values.areEqual(getValue(null, Date.valueOf("2007-12-23")),
            DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(9, 1, 5, 3)))).isFalse();
    assertThat(Values.areEqual(getValue(null, ""), DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(9, 1, 6, 3)))).isFalse();
    assertThat(Values.areEqual(getValue(null, Date.valueOf("2007-12-23")),(DateTimeValue) null)).isFalse();

    assertThat(
        Values.areEqual(getValue(null, Date.valueOf("2007-12-23")),
            DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(9, 1, 6, 2)))).isFalse();
    assertThat(
        Values.areEqual(getValue(null, Date.valueOf("2007-12-23")),
            DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(9, 1, 5, 3)))).isFalse();
    assertThat(
        Values.areEqual(getValue(null, Date.valueOf("2007-12-23")),
            DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(9, 2, 6, 3)))).isFalse();
    assertThat(
        Values.areEqual(getValue(null, Date.valueOf("2007-12-23")),
            DateTimeValue.of(DateValue.of(2007, 12, 23), TimeValue.of(10, 1, 6, 3)))).isFalse();
    assertThat(
        Values.areEqual(getValue(null, Date.valueOf("2007-12-23")),
            DateTimeValue.of(DateValue.of(2007, 12, 3), TimeValue.of(9, 1, 6, 3)))).isFalse();
    assertThat(
        Values.areEqual(getValue(null, Date.valueOf("2007-12-23")),
            DateTimeValue.of(DateValue.of(2007, 2, 23), TimeValue.of(9, 1, 6, 3)))).isFalse();
    assertThat(
        Values.areEqual(getValue(null, Date.valueOf("2007-12-23")),
            DateTimeValue.of(DateValue.of(2008, 12, 23), TimeValue.of(9, 1, 6, 3)))).isFalse();
  }

}


text:
package org.jdom.output;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import org.jdom.Document;
import org.jetbrains.annotations.NonNls;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.Writer;

public class EclipseJDOMUtil {

  @NonNls private static final String ENCODING = CharsetToolkit.UTF8;

  private EclipseJDOMUtil() {
  }

  private static EclipseXMLOutputter createOutputter(String lineSeparator) {
    EclipseXMLOutputter xmlOutputter = new EclipseXMLOutputter(lineSeparator);
    Format format = Format.getCompactFormat().
      setIndent("\t").
      setTextMode(Format.TextMode.NORMALIZE).
      setEncoding(ENCODING).
      setOmitEncoding(false).
      setOmitDeclaration(false);
    xmlOutputter.setFormat(format);
    return xmlOutputter;
  }

  public static void output(final Document doc, final File file, final Project project) throws IOException {
    FileOutputStream out = new FileOutputStream(file);
    try {
      createOutputter(CodeStyleSettingsManager.getSettings(project).getLineSeparator()).output(doc, out);
    }
    finally {
      out.close();
    }
  }

  public static void output(final Document document, final Writer writer, Project project) throws IOException {
    createOutputter(CodeStyleSettingsManager.getSettings(project).getLineSeparator()).output(document, writer);
  }
}